Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,36 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define N 1000000
bool coin_toss() {
return rand() & 1;
}
double run_experiment(int amount) {
int wakings = 0;
int wakings_heads = 0;
for (int i=0; i<amount; i++) {
bool heads = coin_toss();
/* Wake up on Monday */
wakings++;
if (heads) {
wakings_heads++;
continue;
}
/* Wake up on Tuesday */
wakings++;
}
return (double)wakings_heads/(double)wakings;
}
int main(void) {
double chance = run_experiment(N);
printf("Chance of waking up with heads: %f\n", chance);
return 0;
}