A class Randomin Ruby 1.9.2 is guaranteed to generate random numbers in the same order, given a specific seed and range. For instance:
r = Random.new(23)
r.rand(100)
r.rand(100)
But suppose I want to generate the next number in a sequence on another computer (without re-generating earlier numbers in the sequence). This should be possible, given the previous result. Is there any way to do this with the class Random? Or do I need to write my own implementation of Mersenne twister ?
[ Edit: As indicated in the comments below, it is actually impossible to determine the state of an instance Randomfrom output only, since only part of the state (in particular, low 32 bits) is used for output.]
source
share