I want to make a random array of type numpy.float128s. This is not valid:
import numpy as np
a = random.random(100, np.float128) # not valid code
I could do
a = np.random.random(100).astype(np.float128)
but this creates 64 bit floats and then casts them to np.float128 (which is really 80 bit but that isn’t the issue here). So this has the wrong precision.
Is there any way to create an array of random np.float128s in the range 0 to 1?
Is there any way to do this?