aboutsummaryrefslogtreecommitdiff
path: root/Tausworthe.py
blob: 303f3589f9df45610625058c3f764ffd08616dae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import taus

class TauswortheRNG(object):

    def __init__(self, seed=0):
        self.seed = seed
        self.state = taus.seed(seed)

    def randi(self):
        tmp = taus.rand(self.state)
        self.state = tmp[:-1]
        return(tmp[-1])

    def rand(self):
        return self.randi() * 2.3283064365387e-10