On Aug 17, 2019, at 00:02, Patryk Gałczyński <evemorgen1...@gmail.com> wrote:
> 
> One thing I'm concern about is how it would all relate to _randommodule.c (I 
> have little knowledge about C part)

You probably don’t need to change the C code at all. I’m pretty sure none of 
these functions are implemented in C, they just use functions like randbelow 
that in turn use functions that may be implemented in C.

The only things I can imagine to worry about:

 * Does it require copy-pasting a lot of code to do the “faking randbelow on 
top of custom random” thing? If so, does refactoring that have an unacceptable 
performance cost?

 * is the performance cost of a custom random reasonably low, and roughly 
equivalent to shuffle?

 * Is there any danger of throwing away too much entropy (or not having enough 
bits in the first place) to wreck the distribution?

I’m pretty sure you could dispel all of those worries. (For example, for the 
last one, if there’s enough bits to generate N values from [0,N) for shuffle, 
there must be enough to generate 1 value from the same range for choice, right? 
Unless there’s something about shuffle that automatically smooths out 
distortions that you don’t get from choice?)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VTMSPUSCEGOI5GMMZ4WVIFU5YJHQ3FLZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to