I would like to generate seeded random floats of at least 20 decimal places in the range of -1 to 1.
import numpy as np
np.random.seed(2000)
np.random.uniform(low=-1, high=1, size=2)
This is what I would do in the past, but my DOE research requires more precision.
I've looked in to mpmath and decimal modules in python
import mpmath
mpmath.mp.dps = 22
xis = (mpmath.rand() - mpmath.mpf(1), mpmath.rand())
This does not work because I could not find a way to seed mpmath.mp.rand().
import numpy as np
from decimal import Decimal, getcontext
getcontext().prec = 20
xis = np.asarray([Decimal(f"{x}") x for x in np.random.uniform(low=-1, high=1, size=2)], dtype=np.float64)
Here, my floats are dependent on numpy, and has max to 16-7 decimal places.
How can I create random floats that have 20+ decimal places and are seedable?