I need to generate a controlled sequence of pseudo-random numbers, given an initial integer parameter. For that I\'m using the standard Java Random class, seeded by an integ
Yes.
The javadoc explains:
An instance of this class is used to generate a stream of pseudorandom numbers. The class uses a 48-bit seed, which is modified using a linear congruential formula. (See Donald Knuth, The Art of Computer Programming, Volume 2, Section 3.2.1.)
If two instances of
Random
are created with the same seed, and the same sequence of method calls is made for each, they will generate and return identical sequences of numbers. In order to guarantee this property, particular algorithms are specified for the classRandom
. Java implementations must use all the algorithms shown here for theclass Random
, for the sake of absolute portability of Java code. However, subclasses ofclass Random
are permitted to use other algorithms, so long as they adhere to the general contracts for all the methods.