c:other:rand

C++ Reference

rand

Syntax:

    #include <cstdlib>
    int rand( void );

The function rand() returns a pseudorandom integer between zero and RAND_MAX. An example:

     srand( time(NULL) );
     for( i = 0; i < 10; i++ )
       printf( "Random number #%d: %d\n", i, rand() );

Related Topics: srand