|
Author:
{u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}
Message: SERVER-20727 Seed shell random numbers from SecureRandom
Branch: master
https://github.com/mongodb/mongo/commit/8eeed6d77edaf0b0f2b9834d60e5ea0d3aa8e050
|
|
Run the attached script and then issue:
grep -a3 Workloads /tmp/client.log
|
Then uncomment out the sleep and rerun. Note that the first test is almost always the same. There's not enough randomization happening.
|
|
How were you using the randomSeed to generate a random list? The following snippet works for me:
Random.setRandomSeed();
|
|
var nums = []
|
var maxSize = 1000;
|
for(var i = 0; i < maxSize; i++) {
|
var curNum = Random.rand();
|
assert(!Array.contains(nums, curNum));
|
nums.push(curNum);
|
}
|
|
|
I was using this in a similar script and it did not give me a unique value where the randomSeed was used to generate a random list. Without putting in an artificial delay the list was always the same.
|
|
jonathan.abrahams, Date.getTime() returns the milliseconds since the UNIX epoch (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime) - running a for loop of 3 items just happens to take less than a single millisecond. Is there a specific case where this was not sufficient?
|
Generated at Thu Feb 08 03:55:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.