LLVM API Documentation
#include <RandomNumberGenerator.h>
Public Member Functions | |
RandomNumberGenerator (StringRef Salt) | |
uint64_t | next (uint64_t Max) |
Returns a random number in the range [0, Max). |
A random number generator. Instances of this class should not be shared across threads.
Definition at line 28 of file RandomNumberGenerator.h.
Seeds and salts the underlying RNG engine. The salt of type StringRef is passed into the constructor. The seed can be set on the command line via -rng-seed=<uint64>. The reason for the salt is to ensure different random streams even if the same seed is used for multiple invocations of the compiler. A good salt value should add additional entropy and be constant across different machines (i.e., no paths) to allow for reproducible builds. An instance of this class can be retrieved from the current Module.
Definition at line 31 of file RandomNumberGenerator.cpp.
References DEBUG, llvm::errs(), I, Seed, and llvm::StringRef::size().
uint64_t RandomNumberGenerator::next | ( | uint64_t | Max | ) |
Returns a random number in the range [0, Max).
Definition at line 58 of file RandomNumberGenerator.cpp.