Hacker News new | ask | show | jobs
by lkozma 1737 days ago
> However, you're being "too smart for your own good" if you go down this route. A perfectly unbiased input would still have 50% of its inputs rejected, and already you've dropped the speed of the RNG by 50%.

To improve this situation you can use an additional trick: keep track of the sequence of thrown-away pairs, and look at them again in consecutive pairs, and generate some more random bits:

* 00 00 -- throw away

* 11 11 -- throw away

* 00 11 -- output 1

* 11 00 -- output 0

and so on..

see the paper "Iterating Von Neumann's Procedure for Extracting Random Bits" for details.