Routines to handle random number generation and hide platform differences. More...
Go to the source code of this file.
Classes | |
struct | mt |
Structure to hold MT algorithm state to easily allow independant sets of random numbers with different seeds. More... | |
Functions | |
void | mt_init (mt *mt, unsigned int seed) |
Initialize a new MT state with a given seed. | |
unsigned int | mt_rand32 (mt *mt) |
Generate a new 32-bit random number based on the given MT state. | |
double | mt_rand (mt *mt) |
Generate a new random number between [0.0, 1.0) based on the given MT state. | |
void | sg_srandom_time () |
Seed the random number generater with time() so we don't see the same sequence every time. | |
void | sg_srandom_time_10 () |
Seed the random number generater with time() in 10 minute intervals so we get the same sequence within 10 minutes interval. | |
void | sg_srandom (unsigned int seed) |
Seed the random number generater with your own seed so can set up repeatable randomization. | |
double | sg_random () |
Return a random number between [0.0, 1.0). |
Routines to handle random number generation and hide platform differences.
Definition in file sg_random.h.
double sg_random | ( | ) |
Return a random number between [0.0, 1.0).
Definition at line 106 of file sg_random.c.
void sg_srandom | ( | unsigned int | seed | ) |
Seed the random number generater with your own seed so can set up repeatable randomization.
seed | random number generator seed |
Definition at line 101 of file sg_random.c.
void sg_srandom_time_10 | ( | ) |
Seed the random number generater with time() in 10 minute intervals so we get the same sequence within 10 minutes interval.
This is useful for synchronizing two display systems.
Definition at line 95 of file sg_random.c.