Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::Random Class Reference

Random number generator based on SIMD-oriented Fast Mersenne Twister More...

#include <mitsuba/core/random.h>

+ Inheritance diagram for mitsuba::Random:

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 ClassgetClass () 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 Classm_theClass
 
- Static Public Attributes inherited from mitsuba::SerializableObject
static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_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...
 

Detailed Description

Random number generator based on SIMD-oriented Fast Mersenne Twister

Author
Mutsuo Saito and Makoto Matsumoto at Hiroshima University.

Constructor & Destructor Documentation

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.

virtual mitsuba::Random::~Random ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual const Class* mitsuba::Random::getClass ( ) const
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.

uint32_t mitsuba::Random::nextUInt ( uint32_t  n)

Return an integer on the [0, n)-interval.

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.

Remarks
This function is currently not exposed by the Python bindings
void mitsuba::Random::serialize ( Stream stream,
InstanceManager manager 
) const
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.

template<typename Iterator >
void mitsuba::Random::shuffle ( Iterator  it1,
Iterator  it2 
)
inline

Draw a uniformly distributed permutation and permute the given STL container.

See Knuth, TAoCP Vol. 2 (3rd 3d), Section 3.4.2.

Remarks
This function is currently not exposed by the Python bindings

Member Data Documentation

Class* mitsuba::Random::m_theClass
static

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