Random number generator based on SIMD-oriented Fast Mersenne Twister More...
#include <mitsuba/core/random.h>
Public Member Functions | |
Random () | |
Construct a new seeded random generator. More... | |
Random (uint64_t seed) | |
Construct a random generator with a custom seed. More... | |
Random (Random *random) | |
Construct a new random generator seeded from a pre-existing one. More... | |
Random (Stream *stream, InstanceManager *manager) | |
Unserialize a random generator. More... | |
void | set (Random *random) |
Copy the state from another random generator. More... | |
void | seed (uint64_t value=5489ULL) |
Seed the random generator with a single 64bit value. More... | |
void | seed (Random *random) |
Seed the random generator from another random generator. More... | |
void | seed (uint64_t *values, uint64_t length) |
Seed the random generator from an array. More... | |
uint64_t | nextULong () |
Return an integer on the [0, 2^63-1]-interval. More... | |
uint32_t | nextUInt (uint32_t n) |
Return an integer on the [0, n)-interval. More... | |
size_t | nextSize (size_t n) |
Return an integer on the [0, n)-interval. More... | |
Float | nextFloat () |
Return a floating point value on the [0, 1) interval. More... | |
Float | nextStandardNormal () |
Return a normally distributed value. More... | |
template<typename Iterator > | |
void | shuffle (Iterator it1, Iterator it2) |
Draw a uniformly distributed permutation and permute the given STL container. More... | |
void | serialize (Stream *stream, InstanceManager *manager) const |
Serialize a random generator to a binary data stream. More... | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Public Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a serializable object. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
virtual std::string | toString () const |
Return a human-readable string representation of the object's contents. More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::SerializableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
virtual | ~Random () |
Virtual destructor. More... | |
Protected Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject () | |
Construct a serializable object. More... | |
virtual | ~SerializableObject () |
Virtual deconstructor. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Random number generator based on SIMD-oriented Fast Mersenne Twister
mitsuba::Random::Random | ( | ) |
Construct a new seeded random generator.
Uses the default seed on Windows and '/dev/urandom' on OSX and Linux.
mitsuba::Random::Random | ( | uint64_t | seed | ) |
Construct a random generator with a custom seed.
mitsuba::Random::Random | ( | Random * | random | ) |
Construct a new random generator seeded from a pre-existing one.
mitsuba::Random::Random | ( | Stream * | stream, |
InstanceManager * | manager | ||
) |
Unserialize a random generator.
|
protectedvirtual |
Virtual destructor.
|
virtual |
Retrieve this object's class.
Reimplemented from mitsuba::SerializableObject.
Float mitsuba::Random::nextFloat | ( | ) |
Return a floating point value on the [0, 1) interval.
size_t mitsuba::Random::nextSize | ( | size_t | n | ) |
Return an integer on the [0, n)-interval.
Float mitsuba::Random::nextStandardNormal | ( | ) |
Return a normally distributed value.
uint64_t mitsuba::Random::nextULong | ( | ) |
Return an integer on the [0, 2^63-1]-interval.
void mitsuba::Random::seed | ( | uint64_t | value = 5489ULL | ) |
Seed the random generator with a single 64bit value.
void mitsuba::Random::seed | ( | Random * | random | ) |
Seed the random generator from another random generator.
void mitsuba::Random::seed | ( | uint64_t * | values, |
uint64_t | length | ||
) |
Seed the random generator from an array.
|
virtual |
Serialize a random generator to a binary data stream.
Implements mitsuba::SerializableObject.
void mitsuba::Random::set | ( | Random * | random | ) |
Copy the state from another random generator.
|
inline |
Draw a uniformly distributed permutation and permute the given STL container.
See Knuth, TAoCP Vol. 2 (3rd 3d), Section 3.4.2.
|
static |