[libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand

llvm-svn: 352732
This commit is contained in:
Kostya Serebryany 2019-01-31 06:52:55 +00:00
parent 08c60c1894
commit 046cac61c1
1 changed files with 3 additions and 3 deletions

View File

@ -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; }