Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>random() random number generator (macro)</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 random()                Random Number Generator (Macro)

 #include <stdlib.h>

 int        random(num);
 int num;

    random() is a macro that returns an integer value between 0 and
    ('num'-1).  The random number generator is initialized with
    randomize().

       Returns:     An integer between 0 and ('num' - 1).

   Portability:     MS-DOS only.

   -------------------------------- Example ---------------------------------

    The following statements initialize the random number generator and
    print a random number.

           #include <stdlib.h>
           #include <time.h>

           main()
           {
               randomize();
               printf("%d ",random(100));
           }


See Also: rand() randomize()

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