Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    void srand( unsigned int seed );

Description:
    The srand function uses the argument seed to start a new sequence of
    pseudo-random integers to be returned by subsequent calls to  rand.  A
    particular sequence of pseudo-random integers can be repeated by calling
     srand with the same seed value.  The default sequence of pseudo-random
    integers is selected with a seed value of 1.

Returns:
    The  srand function returns no value.

See Also:
    rand

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

    void main()
      {
        int i;

        srand( 982 );
        for( i = 1; i < 10; ++i ) {
            printf( "%d\n", rand() );
        }
        srand( 982 );  /* start sequence over again */
        for( i = 1; i < 10; ++i ) {
            printf( "%d\n", rand() );
        }
      }

Classification:
    ANSI

Systems:
    All

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