python-dice
python-dice copied to clipboard
Add optional quantum random number generator
There are some sites with api for getting quantum random numbers, I think it'd be nice to have: https://qrng.anu.edu.au/API/api-demo.php
They're producing random numbers by reading void fluctuations or something like this. Anyway, these are 100% random numbers. Some online RPG sites are already using quantum numbers.
The only problem that I can think of, this feature will need internet connection.
We could do this by optionally depending on quantumrandom, I think.
Implementing a subclass of random.Random based on that package isn't within the scope of python-dice, but I can PR it to quantumrandom and add an option to supply a custom Random instance. That would also allow users to roll dice using random.SystemRandom if they want.
I've implemented a version of Random that uses quantumrandom with caching, but I'd like to add background thread fetching before posting it.
I've posted the interface here. I'll work on the dice lib modification next.
PR'd the quantumrandom change as lmacken/quantumrandom#22, and you can specify the random engine used by python-dice as of v2.4.0, which is live on PyPI now.