rand_r()

Generate a pseudo-random integer in a thread-safe manner

Synopsis:

#include <stdlib.h>

int rand_r( unsigned int* seed );

Arguments:

seed
A pointer to the seed for the sequence of pseudo-random numbers. If you call rand_r() with the same initial value for the seed, the same sequence is generated.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The rand_r() function computes, in a thread-safe manner, a sequence of pseudo-random integers in the range 0 through RAND_MAX.

Returns:

A pseudo-random integer.

Classification:

POSIX 1003.1 TSF

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Last modified: 2013-12-23

comments powered by Disqus