Paul Crowley <pyt...@paul.ciphergoth.org> added the comment:

Thank you for a very comprehensive and helpful answer!

Yep, reservoir sampling makes n calls not k calls, and so should only be used 
when k is a large fraction of n; in my patch it's k/n >= 1/2.

Because modern CPRNGs are so fast, I had been assuming that overall runtime, 
rather than calls to the RNG; I'll have to bear that in mind here, though in 
general "use a secure seed to whatever secure RNG is fastest" is the right 
strategy.

I don't think hedging against the quality of the RNG is the right thing to do 
here.

I don't mean to suggest you didn't think about this problem hard! It's just 
that I've been obsessing about this problem for the last few weeks for some 
reason (see my repo) so I thought I might be able to help. Thanks again for you 
reply!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35094>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to