Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
Fully Compatible
-
ALL
-
QO 2021-11-15
Description
This is a test-only bug.
When I run setRandomSeed() with no arguments, the seed it prints appears to be wrong, or not reproducible somehow. When I paste the seed back in I get something deterministic but not the same as the original run with no arguments.
After looking a JSSRand() I think the seed that is printed loses some precision when it's converted from int64_t to a Javascript number (a double).
ubuntu@ip-10-122-11-128:~/mongo$ build/debug/install/bin/mongo --nodb --eval 'Random.setRandomSeed(); print(Random.rand())'
|
MongoDB shell version v5.1.0-alpha-1440-gcab0aa7
|
setting random seed: 6952011769478614000
|
0.3131460341608944
|
ubuntu@ip-10-122-11-128:~/mongo$ build/debug/install/bin/mongo --nodb --eval 'Random.setRandomSeed(6952011769478614000); print(Random.rand())'
|
MongoDB shell version v5.1.0-alpha-1440-gcab0aa7
|
setting random seed: 6952011769478614000
|
0.31309103118094894
|
ubuntu@ip-10-122-11-128:~/mongo$ build/debug/install/bin/mongo --nodb --eval 'Random.setRandomSeed(6952011769478614000); print(Random.rand())'
|
MongoDB shell version v5.1.0-alpha-1440-gcab0aa7
|
setting random seed: 6952011769478614000
|
0.31309103118094894
|