add pi
This commit is contained in:
parent
32c9f66d8e
commit
3ce67cc1af
1 changed files with 18 additions and 0 deletions
18
pi.py
Normal file
18
pi.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
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):
|
||||||
|
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:]))
|
||||||
|
return self.numbers.pop(0)
|
||||||
|
|
Loading…
Reference in a new issue