I have a function here that gives a 4 digit string The problem is that when I get the function 500 times or more If I run, it starts returning to the duplicate. How to avoid it?
My Function:
Import Random Def (): Name = SR (Random Print (1000, 99 99) Return Number @ Martian solution is sufficient Because you only need to store and manipulate 9000 numbers. I have a large range and you know (approximate) how many numbers you need, is a better way: the function you want to code without For example, for example 500 different six-digit numbers The use: selected = random.sample (xrange (100000, 1000000), 500)
No comments:
Post a Comment