Implementaion of random.shuffle

Neil Cerutti horpner at yahoo.com
Thu Jul 19 08:05:14 EDT 2007


On 2007-07-19, Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> wrote:
> On Wed, 18 Jul 2007 19:32:35 +0000, George Sakkis wrote:
>
>> On Jul 16, 10:51 pm, Steven D'Aprano
>> <ste... at REMOVE.THIS.cybersource.com.au> wrote:
>>> On Mon, 16 Jul 2007 16:55:53 +0200, Hrvoje Niksic wrote:
>>> > 2**19937 being a really huge number, it's impossible to exhaust the
>>> > Mersenne twister by running it in sequence.
>>>
>>> "Impossible"?
>>>
>>> Surely this will do it:
>>>
>>> for n in xrange(2**19937 + 1):
>>>     random.random()
>>>
>>> Admittedly, if each call to random() took a picosecond, it would still
>>> take 1e5982 centuries to run through the lot. You might want to go make a
>>> coffee or something while you're waiting...
>> 
>> Wow, can you make a coffee in.. 57ms ?
>
> [snip demonstration of xrange raising an exception]
>
> Of course! Can't you?
>
> And if I use a microwave oven, the coffee is made so quickly
> that I actually go backwards in time...

But what happens if you use a microwave oven? ... What the!?!?

-- 
Neil Cerutti



More information about the Python-list mailing list