Anonymous user
Unbias a random generator: Difference between revisions
Simpler D code
(Updated D code) |
(Simpler D code) |
||
Line 296:
}
while ((a =
▲ return a;
}
Line 308 ⟶ 306:
enum int M = 20_000_000;
foreach (n; 3 .. 7) {
immutable a1 = sum(0, map!(_=> biased(n))(iota(M)))
writefln("%d: %2.3f%% %2.3f%%", n,
100.0 * a1 / M, 100.0 * a2 / M);
|