I wrote a C program to generate random numbers between 1 and a million:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
// Initialize the random number generator with the current time
srand(time(NULL));
for (int ctr = 0; ctr < 25; ctr++)
{
// Generate a random number between 1 and 1000000
int random_number = rand() % 1000000 + 1;
// Print the random number
printf("The random number is %d\n", random_number);
}
return 0;
}
However, the numbers aren't high enough. I think they only go up to 30 thousand something.
Anyone know how to fix it so I can get some higher numbers? I want it to be in C.
Thanks.