Discovered in 2013 by then-UPMC-student Jérémie Lumbroso, and independently re-discovered by an Apple programmer last Fall (with much ado on Twitter and Hacker News), the basic idea is as follows: Take your (infinite) random bitstream as the binary digits of random $r\in\left[0,1\right)$…
Python: Using XOFs for general-purpose Random
As always, one's own stack overflow answers make the best blog posts. In this case, we craft a version of random.Random with a few modifications: Pulls its data from an arbitrary stream (in our case, a DRBG such as a hash function or deterministic CSPRNG) Wastes noticeably fewer bits when generating random integers Has fixed code for .shuffle, on the offchance CPython ever changes theirs, and to make it …