Translations:Sorteando Amostras/3/en

De Augusto Baffa Wiki
Ir para navegação Ir para pesquisar
def sample_picker(lst):
    """
    Picks up a random sample from a given list
    """
    # Sets seed based on the decimal portion of the current system clock
    t = time.perf_counter()
    seed = int(10**9*float(str(t-int(t))[0:]))
    
    # Random sample as an index
    s = pseudo_uniform(low=0,high=len(lst),seed=seed,size=1)
    idx = int(s)
    
    return (lst[idx])