I was wondering with the current java 1.7 implementation of the Random class, is it possible for the code below to generate two times the same random long?
Rando
I don't think so. I believe that the generator uses the next number as the seed for the subsequent number. So, if you get a value once, and if it were to repeat, your number generator would be stuck in a loop.
However, many applications are looking for a number in a certain range, which makes it possible to repeat since a subsequent number may have the same value modulo the range.
EDIT: Since you included the source code of next
you can see that if ever it returned the same number, it would always return the same number. Hence, you'd be stuck in a loop of one value.