def randint(a, b):
"Return random integer in range [a, b], including both end points."
return a + randbelow(b - a + 1)
def randbelow(n):
"Return a random int in the range [0,n). Raises ValueError if n<=0."
k = n.bit_length()
numbytes = (k + 7) // 8
while True:
r = int.from_bytes(random_bytes(numbytes), 'big')
r >>= numbytes * 8 - k
if r < n:
return r
def random_bytes(n):
"Return n random bytes"
with open('/dev/urandom', 'rb') as file:
return file.read(n)
list = ["Hello", "No", "Poop", "Ok", "Bruh", "LOL"]
lenlist = len(list)
random_num_that_we_will_use_to_get_an_element_from_list = randint(1, lenlist)
print(list[random_num_that_we_will_use_to_get_an_element_from_list - 1])