summaryrefslogtreecommitdiff
path: root/src/util/random.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/random.cpp')
-rw-r--r--src/util/random.cpp10
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
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback