Converse includes support for random number generation using a 64-bit Linear Congruential Generator (LCG). The user can choose between using a supplied default stream shared amongst all chares on the processor, or creating a private stream. Note that there is a limit on the number of private streams, which at the time of writing was 15,613.
void CrnInitStream(CrnStream *dest, int seed, int type);
Initializes a new stream with its initial state stored in
. The user must supply a seed in
, as well as the
of the stream, where the
can be 0, 1, or 2.
double CrnFloat(CrnStream *genptr);
Returns the next random number in the stream whose state is given by
; the number is returned as a float. (Note: This function is exactly equivalent to