summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-07-24 01:06:40 +0000
committerKostya Serebryany <kcc@google.com>2015-07-24 01:06:40 +0000
commit404c69f2c8c7f7d4993f80fb1f7390571ffe56b6 (patch)
tree6396616273d6126f80ca341473538f9720740094 /llvm/lib/Fuzzer/FuzzerLoop.cpp
parent636cd262d6ae996e76faba51e24eccb603e7e42f (diff)
downloadbcm5719-llvm-404c69f2c8c7f7d4993f80fb1f7390571ffe56b6.tar.gz
bcm5719-llvm-404c69f2c8c7f7d4993f80fb1f7390571ffe56b6.zip
[libFuzzer] allow users to supply their own implementation of rand
llvm-svn: 243078
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index d6533910f00..e659223fe1a 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -113,14 +113,14 @@ void Fuzzer::RereadOutputCorpus() {
void Fuzzer::ShuffleAndMinimize() {
size_t MaxCov = 0;
- bool PreferSmall =
- (Options.PreferSmallDuringInitialShuffle == 1 ||
- (Options.PreferSmallDuringInitialShuffle == -1 && rand() % 2));
+ bool PreferSmall = (Options.PreferSmallDuringInitialShuffle == 1 ||
+ (Options.PreferSmallDuringInitialShuffle == -1 &&
+ USF.GetRand().RandBool()));
if (Options.Verbosity)
Printf("PreferSmall: %d\n", PreferSmall);
PrintStats("READ ", 0);
std::vector<Unit> NewCorpus;
- std::random_shuffle(Corpus.begin(), Corpus.end());
+ std::random_shuffle(Corpus.begin(), Corpus.end(), USF.GetRand());
if (PreferSmall)
std::stable_sort(
Corpus.begin(), Corpus.end(),
OpenPOWER on IntegriCloud