dimanche 28 avril 2019

short way of producing array of randomly draw strings by RandomStringUtils

I would like to produce an array of randomly creating strings in a short way. There is such a way in case ints (instead of strings), so I'm searching for something similar using org.apache.commons.lang3.RandomStringUtils instead of java.util.Random.

I've tried to search through methods for RandomStringUtils, but I didn't found anything useful.

The simple code producing an array of 13 pieces of ints is as follows:

java.util.Random r = new java.util.Random();
int[] toReturn = r.ints(0,100).limit(13).toArray();

Is it possible to find something analogous for RandomStringUtils?




Aucun commentaire:

Enregistrer un commentaire