Generate a pseudo-random integer
#include <stdlib.h> int rand_r( unsigned int* seed );
libc
If _POSIX_THREAD_SAFE_FUNCTIONS is defined, rand_r() computes a sequence of pseudo-random integers in the range 0 to RAND_MAX.
If rand_r() is called with the same initial value for the seed, the same sequence will be generated.
A pseudo-random integer.
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |