![]() |
Public API Reference |
#include <randomgen.h>
Public Methods | |
csRandomGen () | |
Initialize the random number generator using current time(). More... | |
csRandomGen (unsigned iSeed) | |
Initialize the random number generator given a seed. More... | |
void | Initialize () |
Initialize the RNG using current time() as the seed value. More... | |
void | Initialize (unsigned iSeed) |
Select the random sequence number (942,438,978 sequences available). More... | |
float | Get () |
Get a floating-point random number in range 0 <= num < 1. More... | |
unsigned | Get (unsigned iLimit) |
Get a unsigned integer random number in range 0 <= num < iLimit. More... | |
bool | SelfTest () |
Perform a self-test. More... |
The reason for using this class if that you may want a consistent random number generator across all platforms supported by Crystal Space. Besides, in general it is a better quality RNG than the one supplied in most C runtime libraries. Personally I observed a significant improvement in a random terrain generator I made after I switched to this RNG.
Definition at line 38 of file randomgen.h.
|
Initialize the random number generator using current time().
Definition at line 47 of file randomgen.h. References Initialize. |
|
Initialize the random number generator given a seed.
Definition at line 50 of file randomgen.h. References Initialize. |
|
Get a unsigned integer random number in range 0 <= num < iLimit.
|
|
Get a floating-point random number in range 0 <= num < 1.
Definition at line 59 of file randomgen.h. |
|
Select the random sequence number (942,438,978 sequences available).
|
|
Initialize the RNG using current time() as the seed value.
Referenced by csRandomGen. |
|
Perform a self-test.
|