taus

taus — Tausworthe random generator.

Synopsis




#define     IFS_TAUS_MASK
void        ifs_taus_seed                   (void);
unsigned long ifs_taus_get                  (void);

Description

The Tausworthe pseudorandom number generator (maximally equidistributed combined, collision free, with a period about 2113) is intended mainly for IFSgr itself, however you can use it too if random() is not good enough for you.

Before first use the generator has to be seeded with ifs_taus_seed(), pseudorandom numbers can be then obtained from ifs_taus_get().

Details

IFS_TAUS_MASK

#define IFS_TAUS_MASK 0xffffffffUL

The maximum value ifs_taus_get() can return, and a bit mask for numbers ifs_taus_get() can return at the same time.


ifs_taus_seed ()

void        ifs_taus_seed                   (void);

Seed the Tausworthe random generator from /dev/urandom (or what was defined as randomness source when IFSgr was compiled). On failure 1 is used as the default seed.


ifs_taus_get ()

unsigned long ifs_taus_get                  (void);

Get next random number.

This function is not thread safe. As there is no support for explicite seeding (yet?), one random number is like another.

Returns : A random number in the range 0..IFS_TAUS_MASK.