rand_r() — Pseudo-random number generator
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
Single UNIX Specification, Version 2 |
both | OS/390 V2R8 |
Format
#define _XOPEN_SOURCE 500
#include <stdlib.h>
int rand_r(unsigned int *seed);
General description
The rand_r() function generates a sequence of pseudo-random integers in the range 0 to RAND_MAX. (The value of the RAND_MAX macro will be at least 32767.)
If rand_r() is called with the same initial value for the object pointed to by seed and that object is not modified between successive returns and calls to rand_r(), the same sequence shall be generated.
Returned value
rand_r() returns a pseudo-random integer.
There are no documented errno values.