top | item 21881065

(no title)

wombawomba | 6 years ago

This is probably a dumb question, but wouldn't recording the millisecond timestamp mod 2 of each decay be a lot easier and also produce a uniform distribution (at least at the rate this thing seems to be registering decays)?

discuss

order

nategri|6 years ago

Author here.

Not a dumb question! I tried this approach using 4-microsecond ticks and was surprised to catch a (subtle) bias. So I in the end I basically used two different RNG algos (both with slight biases) and XOR’d them together.

Would love to isolate why these on their own appear to have a bias but testing is a super laborious process (takes roughly 3 days to generate a 1 megabit file).

Of course, I could always speed up the testing cycle by using a more radioactive sample ;)

thamer|6 years ago

That's the method described in https://arxiv.org/pdf/1604.03304.pdf on page 11:

> A fast clock (down) is used to increase a counter. Whenever a detection is made (up), the counter is read and reset, generating one random number.

> We restrict to a counter that generates values from 0 to M −1, a modulo M counter. When M = 2 we have a binary random number generator.

It doesn't have to be a millisecond timestamp, any clock that's much faster than the rate of decay should work. Every time a decay is detected, take the elapsed time in clock units mod 2 and that's your random bit.