[Python-ideas] random.choice on non-sequence

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 14 02:03:08 EDT 2016


Steven D'Aprano wrote:
> A formal and precise treatment would have to involve calculus and limits 
> as the probability approaches zero, rather than a flat out "the 
> probability is zero, therefore it's impossible".

The limit of p = 1/n as n goes to infinity is zero.
Events with zero probability can't happen. I don't
know how it can be made more rigorous than that.

I think what this means is that if you somehow wrote
a program to draw a number from an infinite uniform
distribution, it would never terminate.

< A typical value chosen would have a vast
> number of digits, far larger than anything that could be stored in 
> computer memory.

I'm not sure it even makes sense to talk about a
typical number, because for any number you pick,
there are infinitely many numbers with more digits,
but only finitely many with the same or fewer digits.
So the probability of getting only that many digits
is zero, too!

Infinity: Just say no.

-- 
Greg



More information about the Python-ideas mailing list