Make the default seed of the generator returned by deterministicRandom() random. This means that the random number sequence won't be deterministic unless you set a seed.
This commit is contained in:
parent
31e82a6d6d
commit
c027792d0f
|
@ -127,6 +127,8 @@ void setThreadLocalDeterministicRandomSeed(uint32_t seed);
|
|||
|
||||
// Returns the random number generator that can be seeded. This generator should only
|
||||
// be used in contexts where the choice to call it is deterministic.
|
||||
//
|
||||
// This generator is only deterministic if given a seed using setThreadLocalDeterministicRandomSeed
|
||||
Reference<IRandom> deterministicRandom();
|
||||
|
||||
// A random number generator that cannot be manually seeded and may be called in
|
||||
|
|
|
@ -37,7 +37,7 @@ void setThreadLocalDeterministicRandomSeed(uint32_t seed) {
|
|||
|
||||
Reference<IRandom> deterministicRandom() {
|
||||
if(!seededRandom) {
|
||||
seededRandom = Reference<IRandom>(new DeterministicRandom(1, true));
|
||||
seededRandom = Reference<IRandom>(new DeterministicRandom(platform::getRandomSeed(), true));
|
||||
}
|
||||
return seededRandom;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue