Labels

algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)

Generating Random String

/**
* @param length The length of the random string needed
* @return Random String of specified length
*/
public static String randomString(int length){
java.util.UUID uuid=java.util.UUID.randomUUID();
String randomString=uuid.toString();
return randomString.substring(0, length);

}

Note: Works with Java 5+

Search 24 Bytes

Loading...