Converse provides three different Linear Congruential Random Number Generators. Each random number stream has a cycle length of as opposed to ANSI C standard's . Also, each of the three random number streams can be split into a number of per processor streams, so that the random number sequences can be computed in parallel, and are reproducible. Furthermore, there is no implicit critical section in the random number generator,and yet, this functionality is thread-safe, because all the state information is stored in the structure allocated by the programmer. Further, this state information is stored in a first class object, and can be passed to other processors through messages. This module of Converse is based on the public-domain SPRNG5.1 package developed by Ashok Srinivasan5.2 at NCSA.
For minimal change to programs already using C functions rand(), srand(), and drand48(), Converse also maintains a “default” random number stream.
Interface to the Converse Pseudorandom Number Generator module is as follows:
void CrnInitStream(CrnStream *stream, int seed, int type)
Initializes the new random number stream stream of type using seed. type can have values 0, 1, or 2 to represent three types of linear congruential random number generators.
double CrnDouble(CrnStream *stream)
Returns an double precision floating point number between 0 and 1 corresponding to the next random number in the sequence associated with stream. Advances stream by one in the sequence.
float CrnFloat(CrnStream *stream)
Returns a single precision floating point number between 0 and 1 corresponding to the next random number in the sequence associated with stream. Advances stream by one in the sequence.