P
pinkfloydhomer
Using rand() in and old version og gcc, and using Tausworth's method, I
calculated the frequency of 0 or 1 in the first digit like this:
int hist[2] = {0,0};
for (i = 0; i < 100000; ++i)
{
++hist[prng() % 2];
}
For some reason, in both cases, 0 occurs more often than 1, no matter
what seed I use to initialize the prng with. Something like 50150 vs
49850 in the above code.
Does anybody know of a good "binary" PRNG, that is, one that in the
above case would make something closer to 50000 vs 50000?
/David
calculated the frequency of 0 or 1 in the first digit like this:
int hist[2] = {0,0};
for (i = 0; i < 100000; ++i)
{
++hist[prng() % 2];
}
For some reason, in both cases, 0 occurs more often than 1, no matter
what seed I use to initialize the prng with. Something like 50150 vs
49850 in the above code.
Does anybody know of a good "binary" PRNG, that is, one that in the
above case would make something closer to 50000 vs 50000?
/David