dimanche 24 mai 2015

Create a random string of a given cardinality

Is there a builtin (or otherwise trivial) method of generating a random string in Java given a certain given cardinality?

Ie, randStringCard(10,2) would create a random string of length 10 but with only two possible unique values

RandStringCard(1,26) would generate a single character with 26 values, and randStringCard(*,1) would always generate the same output.




Aucun commentaire:

Enregistrer un commentaire