Is this secure?

Robert Kern robert.kern at gmail.com
Wed Feb 24 14:19:23 EST 2010


On 2010-02-24 13:09 PM, mk wrote:
> On 2010-02-24 20:01, Robert Kern wrote:
>> I will repeat my advice to just use random.SystemRandom.choice() instead
>> of trying to interpret the bytes from /dev/urandom directly.
>
> Oh I hear you -- for production use I would (will) certainly consider
> this. However, now I'm interested in the problem itself: why is the damn
> distribution not uniform?

You want "< 234", not "< 235". (234 % 26 == 0), so you get some extra 'a's.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list