]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/nlohmann-json/test/thirdparty/Fuzzer/FuzzerRandom.h
1 //===- FuzzerRandom.h - Internal header for the Fuzzer ----------*- C++ -* ===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_FUZZER_RANDOM_H
13 #define LLVM_FUZZER_RANDOM_H
20 Random(unsigned int seed
) : R(seed
) {}
21 size_t Rand() { return R(); }
22 size_t RandBool() { return Rand() % 2; }
23 size_t operator()(size_t n
) { return n
? Rand() % n
: 0; }
24 intptr_t operator()(intptr_t From
, intptr_t To
) {
26 intptr_t RangeSize
= To
- From
+ 1;
27 return operator()(RangeSize
) + From
;
29 std::mt19937
&Get_mt19937() { return R
; }
36 #endif // LLVM_FUZZER_RANDOM_H