Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

rand_r - pseudo-random number generator (int, thread-safe)

&pagelevel(4)&pagelevel

Syntax

#include <stdlib.h>

int rand_r(unsigned int *seed);

Description

The function rand_r() is the thread-safe version of rand().
The function rand_r() returns an pseudo-random integer between 0 and 215-1. If rand_r() is called with the same initial value for the object pointed to by seed and this object is not changed between sequential calls to rand_r(), the same series of pseudorandom numbers is created.

Return val.

The function rand_r() returns a pseudo-random number.

See also

rand(), stdlib().