This is from the Borland site:
rand() uses a multiplicative congruential random number generator with period 2 to the 32nd power to return successive pseudorandom numbers in the range from 0 to RAND_MAX. The symbolic constant RAND_MAX is defined in stdlib.h
Typical example:
[php]
#include <stdlib.h>
#include <stdio.h>
#include <time.h> // time()
int main(void)
{
int i;
// randomize(); // Borland
srand(time(NULL)); // other compilers
printf("Ten random numbers from 0 to 99\n\n");
for(i=0; i<10; i++)
printf("%d\n", rand() % 100);
return 0;
}
[/php]
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
Offline 5,792 posts
since Oct 2004