LLVM API Documentation

Public Member Functions
llvm::RandomNumberGenerator Class Reference

#include <RandomNumberGenerator.h>

List of all members.

Public Member Functions

 RandomNumberGenerator (StringRef Salt)
uint64_t next (uint64_t Max)
 Returns a random number in the range [0, Max).

Detailed Description

A random number generator. Instances of this class should not be shared across threads.

Definition at line 28 of file RandomNumberGenerator.h.


Constructor & Destructor Documentation

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.

See also:
Module::getRNG

Definition at line 31 of file RandomNumberGenerator.cpp.

References DEBUG, llvm::errs(), I, Seed, and llvm::StringRef::size().


Member Function Documentation

uint64_t RandomNumberGenerator::next ( uint64_t  Max)

Returns a random number in the range [0, Max).

Definition at line 58 of file RandomNumberGenerator.cpp.


The documentation for this class was generated from the following files: