diff options
Diffstat (limited to 'src/util/random.cpp')
-rw-r--r-- | src/util/random.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/random.cpp b/src/util/random.cpp index 86c569a4a..7c6abd33e 100644 --- a/src/util/random.cpp +++ b/src/util/random.cpp @@ -23,6 +23,16 @@ namespace CVC4 { +Random::Random(uint64_t seed) { setSeed(seed); } + +void Random::setSeed(uint64_t seed) +{ + d_seed = seed == 0 ? ~seed : seed; + d_state = d_seed; +} + +uint64_t Random::operator()() { return rand(); } + uint64_t Random::rand() { /* xorshift* generator (see S. Vigna, An experimental exploration of |