You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Should double check this is official specit"returns the same numeric output for a given seed across all implementations and platforms"dornd=Random.new(33)rnd.bytes(2).should == "\x14\\"rnd.bytes(1000)# skip somernd.bytes(2).should == "\xA1p"end
The documentation of Random contains the following line:
PRNGs are currently implemented as a modified Mersenne Twister with a period of 2**19937-1.
Although it is described as being modified, I can't find any documentation on how it is modified without digging into the Ruby source code. In Natalie, we tried this using std::mt19937. This results in different output and fails the test (see natalie-lang/natalie#919)
Given that there already is a comment about whether this is the official spec, and there is no official documentation on how the MRI implementation actually works except for the code itself, I'm not sure this check should be in the spec.
The text was updated successfully, but these errors were encountered:
Because it is very valuable when running some Ruby app on another Ruby to actually have the same Random values when given the same seed (e.g. via srand).
I'll just remove that comment.
The spec core/random/bytes has a few checks for the exact results:
The documentation of Random contains the following line:
Although it is described as being modified, I can't find any documentation on how it is modified without digging into the Ruby source code. In Natalie, we tried this using
std::mt19937
. This results in different output and fails the test (see natalie-lang/natalie#919)Given that there already is a comment about whether this is the official spec, and there is no official documentation on how the MRI implementation actually works except for the code itself, I'm not sure this check should be in the spec.
The text was updated successfully, but these errors were encountered: