Defined in header
Returns a pseudo-random integral value between 0 and RAND_MAX (0 and
std::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 on successive calls. Other functions in the standard library may call
rand, it is implementation-defined which functions do so.
It is implementation-defined whether
rand() is thread-safe.
Pseudo-random integral value between 0 and RAND_MAX.
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.
It is recommended to use C++11's random number generation facilities to replace rand(). (since C++11)
Random value on [0 2147483647]: 1373858591
| produces integer values evenly distributed across a range |
| seeds pseudo-random number generator |
| maximum possible value generated by std::rand |
| generates a random integer in the specified range |
C documentation for rand