about summary refs log tree commit diff homepage
path: root/lib/Core/Searcher.cpp
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2020-06-25 21:35:25 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-07-30 16:44:31 +0100
commit661fba88fff0205ea258a1149907f2822458cd83 (patch)
treef9bc1fb96d55d55312dd10b19a0cf94a7ebe89e7 /lib/Core/Searcher.cpp
parent169022a56d62cdb2f15540a0c592c5f90fdb39cb (diff)
downloadklee-661fba88fff0205ea258a1149907f2822458cd83.tar.gz
introduce --rng-initial-seed=<unsigned>
* move global theRNG into Executor
* pass theRNG via ctor to searchers
* remove some type warnings from RNG.cpp

Fixes #1023.
Diffstat (limited to 'lib/Core/Searcher.cpp')
-rw-r--r--lib/Core/Searcher.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/Core/Searcher.cpp b/lib/Core/Searcher.cpp
index 765784c5..d6cf8dfd 100644
--- a/lib/Core/Searcher.cpp
+++ b/lib/Core/Searcher.cpp
@@ -41,10 +41,6 @@ using namespace klee;
 using namespace llvm;
 
 
-namespace klee {
-  extern RNG theRNG;
-}
-
 Searcher::~Searcher() {
 }
 
@@ -166,9 +162,10 @@ RandomSearcher::update(ExecutionState *current,
 
 ///
 
-WeightedRandomSearcher::WeightedRandomSearcher(WeightType _type)
+WeightedRandomSearcher::WeightedRandomSearcher(WeightType type, RNG &rng)
   : states(new DiscretePDF<ExecutionState*>()),
-    type(_type) {
+    theRNG{rng},
+    type(type) {
   switch(type) {
   case Depth:
   case RP:
@@ -261,8 +258,10 @@ bool WeightedRandomSearcher::empty() {
   return states->empty(); 
 }
 
-RandomPathSearcher::RandomPathSearcher(PTree &_processTree)
-    : processTree(_processTree), idBitMask(_processTree.getNextId()) {}
+///
+RandomPathSearcher::RandomPathSearcher(PTree &processTree, RNG &rng)
+  : processTree{processTree}, theRNG{rng}, idBitMask{processTree.getNextId()} {
+}
 
 RandomPathSearcher::~RandomPathSearcher() {
 }