Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

NUM::RandomNumberGenerator_LibCRandom Class Reference

Interface to standard libc random() PRNG. More...

#include <libc.h>

Inheritance diagram for NUM::RandomNumberGenerator_LibCRandom:

Inheritance graph
[legend]
Collaboration diagram for NUM::RandomNumberGenerator_LibCRandom:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RandomNumberGenerator_LibCRandom (uint32 s)
 Initialize PRNG with passed seed value. See seed().

 ~RandomNumberGenerator_LibCRandom ()
 Destructor.

void seed (uint32 seed)
 Re-initialize ("seed") the PRNG with seed value.

void seed (uint seed, int statelen)
 Re-initialize ("seed") the PRNG with seed value and tell it to internally use state buffer of length statelen bytes (8,16,32,64,128,256).

uint32 rand_uint32 ()
 Generates a random number on [0,0xffffffff]-interval (slow).

int32 rand_int32 ()
 Generates a random number on [0,0x7fffffff]-interval (fast).

dbl rand_dbl32o ()
 Generates a "31-bit" random number on [0,1)-real-interval.

dbl rand_dbl32 ()
 Generates a "31-bit" random number on [0,1]-real-interval.

dbl rand_dbl53o ()
 Generates a "53-bit" random number on [0,1)-real-interval.

dbl rand_dbl53 ()
 Generates a "53-bit" random number on [0,1]-real-interval.


Private Member Functions

int32 _rand31 ()
 RandomNumberGenerator_LibCRandom (const RandomNumberGenerator_LibCRandom &)
 Do not use.

void operator= (const RandomNumberGenerator_LibCRandom &)
 Do not use.


Private Attributes

random_data rdata
char * statebuf

Detailed Description

Interface to standard libc random() PRNG.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This class uses the re-entrant versions of the LIBC random() family of functions and saves the state in the class. Hence, different instances of RandomNumberGenerator_LibCRandom provide independent PRNGs.

Class is not "C++-safe"; please use the RandomNumberGenerator class.

Definition at line 46 of file libc.h.


Constructor & Destructor Documentation

NUM::RandomNumberGenerator_LibCRandom::RandomNumberGenerator_LibCRandom const RandomNumberGenerator_LibCRandom  )  [private]
 

Do not use.

NUM::RandomNumberGenerator_LibCRandom::RandomNumberGenerator_LibCRandom uint32  s  )  [inline]
 

Initialize PRNG with passed seed value. See seed().

Definition at line 62 of file libc.h.

References seed(), statebuf, and uint32.

NUM::RandomNumberGenerator_LibCRandom::~RandomNumberGenerator_LibCRandom  )  [inline]
 

Destructor.

Definition at line 66 of file libc.h.

References FREE(), and statebuf.


Member Function Documentation

int32 NUM::RandomNumberGenerator_LibCRandom::_rand31  )  [inline, private]
 

Definition at line 52 of file libc.h.

References int32, and rdata.

Referenced by rand_dbl32(), rand_dbl32o(), rand_dbl53(), rand_dbl53o(), rand_int32(), and rand_uint32().

void NUM::RandomNumberGenerator_LibCRandom::operator= const RandomNumberGenerator_LibCRandom  )  [private]
 

Do not use.

dbl NUM::RandomNumberGenerator_LibCRandom::rand_dbl32  )  [inline, virtual]
 

Generates a "31-bit" random number on [0,1]-real-interval.

Reimplemented from NUM::RandomNumberGenerator_Base.

Definition at line 98 of file libc.h.

References _rand31(), and dbl.

dbl NUM::RandomNumberGenerator_LibCRandom::rand_dbl32o  )  [inline, virtual]
 

Generates a "31-bit" random number on [0,1)-real-interval.

Reimplemented from NUM::RandomNumberGenerator_Base.

Definition at line 94 of file libc.h.

References _rand31(), and dbl.

dbl NUM::RandomNumberGenerator_LibCRandom::rand_dbl53  )  [inline, virtual]
 

Generates a "53-bit" random number on [0,1]-real-interval.

Reimplemented from NUM::RandomNumberGenerator_Base.

Definition at line 109 of file libc.h.

References _rand31(), dbl, and int32.

dbl NUM::RandomNumberGenerator_LibCRandom::rand_dbl53o  )  [inline, virtual]
 

Generates a "53-bit" random number on [0,1)-real-interval.

Reimplemented from NUM::RandomNumberGenerator_Base.

Definition at line 102 of file libc.h.

References _rand31(), dbl, and int32.

int32 NUM::RandomNumberGenerator_LibCRandom::rand_int32  )  [inline, virtual]
 

Generates a random number on [0,0x7fffffff]-interval (fast).

Reimplemented from NUM::RandomNumberGenerator_Base.

Definition at line 90 of file libc.h.

References _rand31(), and int32.

uint32 NUM::RandomNumberGenerator_LibCRandom::rand_uint32  )  [inline, virtual]
 

Generates a random number on [0,0xffffffff]-interval (slow).

Reimplemented from NUM::RandomNumberGenerator_Base.

Definition at line 86 of file libc.h.

References _rand31(), and uint32.

void NUM::RandomNumberGenerator_LibCRandom::seed uint  seed,
int  statelen
 

Re-initialize ("seed") the PRNG with seed value and tell it to internally use state buffer of length statelen bytes (8,16,32,64,128,256).

Definition at line 22 of file libc.cc.

References rdata, REALLOC(), statebuf, and uint.

void NUM::RandomNumberGenerator_LibCRandom::seed uint32  seed  )  [inline, virtual]
 

Re-initialize ("seed") the PRNG with seed value.

Initializes the state vector by using one unsigned 32-bit integer "seed".

Reimplemented from NUM::RandomNumberGenerator_Base.

Definition at line 75 of file libc.h.

References rdata, and uint32.

Referenced by RandomNumberGenerator_LibCRandom().


Member Data Documentation

random_data NUM::RandomNumberGenerator_LibCRandom::rdata [private]
 

Definition at line 49 of file libc.h.

Referenced by _rand31(), and seed().

char* NUM::RandomNumberGenerator_LibCRandom::statebuf [private]
 

Definition at line 50 of file libc.h.

Referenced by RandomNumberGenerator_LibCRandom(), seed(), and ~RandomNumberGenerator_LibCRandom().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:36:01 2005 for Ray by doxygen 1.3.5