pandora_cdosea/pi.py

21 lines
534 B
Python
Raw Permalink Normal View History

2017-01-04 17:29:24 +00:00
from mpmath import mp
mp.dps = 10000
PI = str(mp.pi).replace('.', '')
class random(object):
PI = str(mp.pi).replace('.', '')
def __init__(self, offset=0):
2017-10-02 11:37:53 +00:00
self.position = offset
2017-01-04 17:29:24 +00:00
self.numbers = list(map(int, self.PI[offset:]))
def __call__(self):
if not self.numbers:
offset = mp.dps
mp.dps += 1000
self.PI = str(mp.pi).replace('.', '')
self.numbers = list(map(int, self.PI[offset:]))
2017-10-02 11:37:53 +00:00
self.position += 1
2017-01-04 17:29:24 +00:00
return self.numbers.pop(0)