Namespaces
Variants
Actions

rand

From cppreference.com
< c‎ | numeric‎ | random
Defined in header <stdlib.h>
int rand();

Returns a pseudo-random integer value between 0 and RAND_MAX (0 and RAND_MAX included).

srand() seeds the pseudo-random number generator used by rand(). If rand() is used before any calls to srand(), rand() behaves as if it was seeded with srand(1). Each time rand() is seeded with srand(), it must produce the same sequence of values.

rand() is not guaranteed to be thread-safe.

Contents

[edit] Parameters

(none)

[edit] Return value

Pseudo-random integer value between 0 and RAND_MAX, inclusive.

[