Generate a pseudo-random integer in a thread-safe manner
#include <stdlib.h> int rand_r( unsigned int* seed );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The rand_r() function computes, in a thread-safe manner, a sequence of pseudo-random integers in the range 0 through RAND_MAX.
A pseudo-random integer.
POSIX 1003.1 OB. This function is marked as obsolescent, and may be removed from a future version of the standard.
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |