cdosea-play/cdoseaplay/pi.py

19 lines
526 B
Python
Raw Normal View History

2017-10-16 18:31:44 +00:00
from mpmath import mp
class random(object):
def __init__(self, offset=0):
self.position = offset
2023-12-19 13:25:02 +00:00
mp.dps = 10000 + offset
self.PI = str(mp.pi).replace('.', '')
2017-10-16 18:31:44 +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:]))
self.position += 1
return self.numbers.pop(0)