vendredi 26 octobre 2018

Question about java and nextvytes: nextbytes keeps returning the samle value

So I am trying to fill a byte array with a set of random values. However, I keep getting the same data every time I run the program. Here is my code:

byte [] result = new byte[1024*1024];

new Random().nextBytes(result);

System.out.println(Arrays.toString(result));

or just

System.out.println(result);

I am not getting random numbers and I'm not sure why. I would appreciate some help with this.

Thanks




Aucun commentaire:

Enregistrer un commentaire