std::rand

From Cppreference

Jump to: navigation, search
Defined in header <cstdlib>

int rand();

Returns a pseudo-random integral value between 0 and RAND_MAX.

srand() should be called before any calls to rand() to initialize the random number generator to random value.

Contents

[edit] Parameters

(none)

[edit] Return value

pseudo-random integral value between 0 and RAND_MAX.

[edit] Example

[edit] See also

srand
initializes pseudo-random number generator
(function)