diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-11-13 10:13:25 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-11-13 17:35:46 -0500 |
commit | 68a2023506a217e787e0cb50d7de60b36d4fa17f (patch) | |
tree | 7877ba21503746a3f76d06245b3f2815e4a1de8f /src/mongo/platform/random.cpp | |
parent | 93fdafcb4c4883d401a0726b67f2141404daa9ee (diff) | |
download | mongo-68a2023506a217e787e0cb50d7de60b36d4fa17f.tar.gz |
some Random tests and helpers
Diffstat (limited to 'src/mongo/platform/random.cpp')
-rw-r--r-- | src/mongo/platform/random.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/platform/random.cpp b/src/mongo/platform/random.cpp index 97bde99da4a..fabb4bf69b4 100644 --- a/src/mongo/platform/random.cpp +++ b/src/mongo/platform/random.cpp @@ -48,6 +48,15 @@ namespace mongo { return rand_r( &_seed ); } #endif + PseudoRandom::PseudoRandom( int64_t seed ) { + _seed = static_cast<uint32_t>( seed ); + } + + int64_t PseudoRandom::nextInt64() { + int64_t a = nextInt32(); + int64_t b = nextInt32(); + return ( a << 32 ) | b; + } // --- SecureRandom ---- |