randomFromSequence static method
Returns random String with given length
of chars form sequence
.
Implementation
static String randomFromSequence(int length, String sequence) {
final output = StringBuffer();
final rnd = math.Random();
for (int i = 0; i < length; i++) {
output.write(sequence[rnd.nextInt(sequence.length)]);
}
return output.toString();
}