vendredi 1 mars 2019

Get better random value with Groovy

I use following Groovy code to select random elements from a list.

Random rnd = new Random()
log.info("Random element:" + list[rnd.nextInt(list.size)])

I get previous or next element as a "random" value in most cases.




Aucun commentaire:

Enregistrer un commentaire