Last comment on the subject: the problem is not that it will run forever - it won't. The problem is that it could - because it is fundamentally wrong to try and exhaust the combinations of a list by randomly picking from them. I couldn't care less if the probability tends to 0 on infinity time, or whatever. This is not a math forum, this is a coding forum. If I ever do a code review with such snippet, I'd reject the commit, as would any sensible engineer. Comment will remain there, as it could make both OP and responder to learn something new and relevant. —
Rodrigo Rodrigues 45 secs ago