dimanche 2 octobre 2016

Java Random generating all 1's

this has stumped me. why would this return a string of all 1's? I do believe that it has something to do with the seed value. when that is changed the numbers become much more diverse.

Random random = new Random(441287210L);

for (int i = 0; i < 10; i++)
   System.out.print(random.nextInt(10) + " ");

any ideas?




Aucun commentaire:

Enregistrer un commentaire