summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerRandom.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2019-01-31 06:52:55 +0000
committerKostya Serebryany <kcc@google.com>2019-01-31 06:52:55 +0000
commit6a8fdafd02d26a9637ef16d55e951a68ac1969ea (patch)
treea23f5c7dd06114170f6f25033d38e8460badb7b0 /lib/fuzzer/FuzzerRandom.h
parent446ca1a1fc142b943ded6de387265eb0622af3db (diff)
downloadcompiler-rt-6a8fdafd02d26a9637ef16d55e951a68ac1969ea.tar.gz
[libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@352732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerRandom.h')
-rw-r--r--lib/fuzzer/FuzzerRandom.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/fuzzer/FuzzerRandom.h b/lib/fuzzer/FuzzerRandom.h
index f47579787..4dde7d84d 100644
--- a/lib/fuzzer/FuzzerRandom.h
+++ b/lib/fuzzer/FuzzerRandom.h
@@ -14,10 +14,10 @@
#include <random>
namespace fuzzer {
-class Random : public std::mt19937 {
+class Random : public std::minstd_rand {
public:
- Random(unsigned int seed) : std::mt19937(seed) {}
- result_type operator()() { return this->std::mt19937::operator()(); }
+ Random(unsigned int seed) : std::minstd_rand(seed) {}
+ result_type operator()() { return this->std::minstd_rand::operator()(); }
size_t Rand() { return this->operator()(); }
size_t RandBool() { return Rand() % 2; }
size_t operator()(size_t n) { return n ? Rand() % n : 0; }