diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-07-09 14:48:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-10 08:58:20 +0100 |
commit | 5b2f8231945fedc46425e00f1234dcac90628c1d (patch) | |
tree | 7cdee4b82bd29d59292d0a4bd4df4e816317192c /comphelper/source | |
parent | 315afb12853624bdaac553a8528390c3a61c8351 (diff) |
add a SAL_RAND_REPEATABLE for repeatable random nums
merge the formula and comphelper ones together
Change-Id: I2e7e2cdb176afc6982e384fa1e007da5b914e6f0
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/misc/random.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/comphelper/source/misc/random.cxx b/comphelper/source/misc/random.cxx index 0c6e83edd20a..a70a73e3584b 100644 --- a/comphelper/source/misc/random.cxx +++ b/comphelper/source/misc/random.cxx @@ -39,6 +39,13 @@ struct RandomNumberGenerator STD_RNG_ALGO global_rng; RandomNumberGenerator() { + bool bRepeatable = (getenv("SAL_RAND_REPEATABLE") != 0); + if (bRepeatable) + { + global_rng.seed(42); + return; + } + try { std::random_device rd; |