Trying to use progress.
This commit is contained in:
parent
5c1c5654d1
commit
4d89477bce
11
src/main.c
11
src/main.c
@ -72,13 +72,22 @@ int main(int argc, char **argv) {
|
|||||||
// Setup the random number generator with the seed being the time
|
// Setup the random number generator with the seed being the time
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
|
//int oldprogress = 0;
|
||||||
|
|
||||||
printf("Calculating random numbers...\n");
|
printf("Calculating random numbers...\n");
|
||||||
|
//printf("Progress: 0 %%\n");
|
||||||
for(int i = 0; i < trials; i++) {
|
for(int i = 0; i < trials; i++) {
|
||||||
if(i % 100000000 == 0) printf("Working...\n");
|
/*int progress = i * 100 / trials;
|
||||||
|
if(progress != oldprogress && progress % 10 == 0) {
|
||||||
|
printf("Progress: %i %%\n", progress);
|
||||||
|
oldprogress = progress;
|
||||||
|
}*/
|
||||||
|
//if(i % 100000000 == 0) printf("Working...\n");
|
||||||
int r = rand() % 100 + 1; // Calculate random number between 1 and 100
|
int r = rand() % 100 + 1; // Calculate random number between 1 and 100
|
||||||
if(r <= 50) heads++;
|
if(r <= 50) heads++;
|
||||||
else tails++;
|
else tails++;
|
||||||
}
|
}
|
||||||
|
//printf("Progress: 100 %%\n");
|
||||||
|
|
||||||
printf("Done.\n");
|
printf("Done.\n");
|
||||||
printf("Heads: %i\n", heads);
|
printf("Heads: %i\n", heads);
|
||||||
|
Loading…
Reference in New Issue
Block a user