Created
October 9, 2015 15:40
-
-
Save jon-ruckwood/e93894d34a8552b4e92a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RandomString { | |
public static String randomString(int len) { | |
final StringBuilder buffer = new StringBuilder(len); | |
ThreadLocalRandom.current() | |
.ints(len, 'A', 'Z') | |
.mapToObj(Character::toChars) | |
.forEach(buffer::append); | |
return buffer.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment