Translations:Gerador Aleatório Mersenne Twister/4/en
Ir para navegação
Ir para pesquisar
def mersenne_twister(mult=16807,mod=(2**31)-1,period=(2**30),min=0,max=1,seed=123456789, size=1):
"""Pseudorandom number generater"""
MT = []
for i in range(size):
seed = (mult * seed) % mod
MT.append( (max - min) * (seed / mod) + min )
period -= 1
if period == 0:
print("Pseudorandom period nearing!!")
if size == 1:
return MT.pop()
else:
return MT