Currently At: Programming Reference > C Reference > Other standard C functions > rand()

rand()


Syntax:
#include <stdlib.h>
int rand( void );


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

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


Related Topics:
srand()


Web Standards & Support:

Link to and support eLook.org Powered by LoadedWeb Web Hosting
Valid XHTML 1.0! Valid CSS! eLook.org FireFox Extensions