Borland C++ reference

random

raw OCR

Random number generator.

Defined in header <stdlib.h>

Syntax

#include <stdlib.h>
int random(int niim);

random  returns a random  number  between  0 and (num-1). random(num)

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

is a macro defined in stdlib.h. Both num and the random number returned are integers.

Return value

random returns a number between 0 and (num-l).

See also

Example

include  <stdlib.h>
#include <stdio.h>
#include <time.h>
int mainO       /* prints a random number in the range 0 to 99  */
{
   randomized ;
   printf("Random number in the 0-99 range: %d\n", random  (100));
   return 0;
}

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.