Defined in header
Returns a pseudo-random integer value between 0 and RAND_MAX (0 and
srand() seeds the pseudo-random number generator used by
rand() is used before any calls to
rand() behaves as if it was seeded with
rand() is seeded with
srand(), it must produce the same sequence of values.
rand() is not guaranteed to be thread-safe.
 Return value
Pseudo-random integer value between 0 and RAND_MAX, inclusive.
There are no guarantees as to the quality of the random sequence produced.
In the past, some implementations of
rand() have had serious shortcomings in the randomness, distribution and period of the sequence produced (in one well-known example, the low-order bit simply alternated between
0 between calls).
rand() is not recommended for serious random-number generation needs, like cryptography.
POSIX requires that the period of the pseudo-random number generator used by
rand is at least 232
POSIX offered a thread-safe version of rand called rand_r, which is obsolete in favor of the drand48 family of functions.
Random value on [0 2147483647]: 1373858591
- C11 standard (ISO/IEC 9899:2011):
- 18.104.22.168 The rand function (p: 346)
- C99 standard (ISO/IEC 9899:1999):
- 22.214.171.124 The rand function (p: 312)
- C89/C90 standard (ISO/IEC 9899:1990):
- 126.96.36.199 The rand function
 See also
| seeds pseudo-random number generator |
| maximum possible value generated by rand() |
C++ documentation for rand