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.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |