Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>srand</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
srand

Usage

   #include <stdlib.h>
   void srand(unsigned seed);

   ANSI

Description

   srand initializes the random number generator rand() with a seed number.
   If srand() is never called, then the default is as if srand(1) was
   called.

Example 

   #include <stdio.h>
   #include <stdlib.h>

   int main()
   {
       int i;
       srand(9);
       for(i = 0;i < 20;i++)
           printf("i: %d rand(): %d\n",i,rand());
       return EXIT_SUCCESS;
   }

See Also

   rand



See Also: rand

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson