Description of the routines contained in:
rand.c
Sometimes it is useful to use sophisticated routines to produce random
numbers. The file rand.c
contains a couple of quite good
random number generators. If you want to use one of them, first call
the routine rnd_init(seed) with some integer
number seed to initialize the generators. You
have the choice between the following generators:
- rnd_long(): It returns an unsigned long
random number generated by the following rule:
xn+1=xn-9689 XOR
xn-157 XOR xn-314 XOR
xn-471
It has a period of 2^9689 and the numbers are uncorrelated up to 4
point correlations.
- rnd_1279(): It returns an unsigned long
random number generated by the following rule:
xn+1=xn-1279+
xn-216+xn-299+
xn-598
It has a period of 2^1279 and the numbers are uncorrelated up to 4
point correlations.
- rnd69069(): It returns an unsigned long
random number generated by the following rule:
xn+1=xn*factor+1
where factor=69069 on 32 Bit machines and factor=13^13 on 64 Bit
machines. This one is fast and especially on 64 Bit machines good for
almost all purposes.
- gaussian(): Returns random numbers which
are distributed gaussian with a variance of
variance centered around zero. Interally it
uses the routine rnd_1279().
View the C-sources.
Table of Contents * TISEAN home