According to docs , java.util.Random.next is implemented as follows:
synchronized protected int next(int bits) { seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); return (int)(seed >>> (48 - bits)); }
There is nothing that takes variable time, but is largely due to the fact that it deals only with fixed-length numbers.
So, the Java random number generator, which is not even a random number generator, but a pseudo random number generator, is not very good, as noted.
harold
source share