rand, rand_r
Computes a sequence of pseudo-random integers in the range 0 to RAN_MAX (32767)
#include <stdlib.h> int rand (void);
#include <stdlib.h>
int rand_r (
unsigned long *seed);
If the seed parameter is set to NULL, -1 is returned and errno is set to EINVAL.
If the value parameter is set to NULL, a value is returned but the value is not stored.
rand_r is the same as rand except that the caller passes storage for the seed and the result rather than relying on a global variable (which has the potential of being modified by subsequent calls to rand by other threads in the same NLM).
rand_r is supported only in CLIB V 4.11 or above.
The sequence of pseudo-random integers can be started at different values by calling the srand function.