Code golf challenge: XKCD 936 passwords
Roy Smith
roy at panix.com
Tue Oct 8 22:52:36 EDT 2013
In article <mailman.885.1381284610.18130.python-list at python.org>,
Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Oct 9, 2013 at 12:38 PM, Roy Smith <roy at panix.com> wrote:
> > If you're willing to accept a sub-optimal random number generator:
> >
> > # Python-2, sorry
> > import os
> > print list(set(open('/usr/share/dict/words')))[os.getpid():][:4]
>
> So that steps by your pid? That's going to drastically reduce the
> entropy in the result,
Well, I did say it was a sub-optimal random number generator :-)
I've been experimenting with os.urandom() as an entropy source, but
can't get the (source code) character count down far enough.
More information about the Python-list
mailing list