[Python-ideas] About adding a new iteratormethodcalled "shuffled"

Nick Coghlan ncoghlan at gmail.com
Wed Mar 25 13:34:49 CET 2009


Raymond Hettinger wrote:
> 
>> Greg> Think about it: A shuffling algorithm is a function from a random
>> Greg> number to a permutation. There's no way you can get more
>> permutations
>> Greg> out than there are random numbers to put in.
> 
> If our random number generator can produce more possible shuffles than
> there are atoms in the universe, I say you don't worry about it.

The "long int too large to convert to float" error that I got on my
first attempt at printing 2080! in scientific notation is also something
of a hint :)

The decimal module came to my rescue though:

>>> +Decimal(math.factorial(2080))
Decimal('1.983139957541900373849131897E+6000')

That's one heck of a big number!

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list