python random module uses time as the seed (right?), which is predictable, and sets are displayed in random order so if we use sets and random module and time module together, will it result in more randomness? and is it less predictable?
a code like this:
import random
from typing import Union
import time
def get_random_item(iterator: Union[set, list, tuple], seed=None):
iterator = set(iterator)
if seed is None:
seed = time.time() / 10 ** (len(str(int(time.time()))) - 1)
seed = int(((seed ** seed ** random.random() ** random.random()) * (10 ** random.randrange(9, 16))) % len(iterator))
return list(iterator)[seed]
Aucun commentaire:
Enregistrer un commentaire