Last active
March 5, 2023 11:56
-
-
Save naazeri/e9100834bd2d14cd61c160857520f128 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
numbers = [] | |
def getUniqueRandom(start, end): | |
while True: | |
n = random.randrange(start, end) | |
if n not in numbers: | |
return n | |
for i in range(100): | |
n = getUniqueRandom(1, 500) | |
numbers.append(n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment