文字列をランダムで出力する方法

ex)アルファベット10文字

String str1 = RandomStringUtils.randomAlphabetic(10);

結果:lPuIBtUDse




ex)数字5文字

String str2 = RandomStringUtils.randomNumeric(5);

結果:76407




おまけ
先頭の文字だけ大文字で、他は小文字で表示させる方法

String str3 = RandomStringUtils.randomAlphabetic(8);
str3 = str3.substring(0, 1).toUpperCase() + str3.substring(1).toLowerCase();
System.out.println(str3);

結果:Aotiqquk