EN
Java - generate array of random bytes
2
points
1. ThreadLocalRandom.nextBytes
byte[] arr = new byte[10];
ThreadLocalRandom.current().nextBytes(arr);
// [-62, -75, 50, -127, 86, -21, 84, 53, 34, -45]
System.out.println(Arrays.toString(arr));
2. Random.nextBytes
byte[] arr = new byte[10];
new Random().nextBytes(arr);
// [-50, -67, 109, -126, 24, 118, -121, -77, 15, -97]
System.out.println(Arrays.toString(arr));