cnet's Application Programming Interface

NAME
CNET_srand, CNET_rand - generate pseudo-random numbers

SYNOPSIS
#include <cnet.h>

void CNET_srand(unsigned int seed);

long CNET_rand(void);

DESCRIPTION
Each node has its own pseudo-random number generator so that the frequency of requests for random numbers in one node does not interfere with those of other nodes.

CNET_srand seeds the current node's random number generator. A typical use is:

     CNET_srand(nodeinfo.time_of_day.sec + nodeinfo.nodenumber);

If the -S command-line option is provided, it will be used to seed each node's random number generator, and the argument to CNET_rand() will be ignored.

CNET_rand returns the next long integer in the random sequence on [0..MAXLONG]. A typical use is:

    even = (CNET_rand() % 2) == 0;

cnet employs the Mersenne Twister (MT19937) random number generator.

RETURN VALUE
CNET_srand always succeeds.
CNET_rand returns the next long integer in the random sequence on [0..MAXLONG].

SEE ALSO
CNET_newrand and CNET_nextrand
The Mersenne Twister home page.

 cnet v3.3.4, written by Chris.McDonald@uwa.edu.au
 Last modified: Tue Mar 1 7:43AM 2016