From 661fba88fff0205ea258a1149907f2822458cd83 Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Thu, 25 Jun 2020 21:35:25 +0100 Subject: introduce --rng-initial-seed= * move global theRNG into Executor * pass theRNG via ctor to searchers * remove some type warnings from RNG.cpp Fixes #1023. --- lib/Core/Searcher.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/Core/Searcher.cpp') 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()), - 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() { } -- cgit v1.2.3