I'm trying to generate floats however not within [0-1) but sys.float_info.max
and sys.float_info.min
. Unfortunately Python's random and Numpy random work as this way
a + (b-a) * random()
But random() does not generate small enough numbers to compete with exponent of MAX float.
print min([random.uniform(0, sys.float_info.max) for i in range(10000)])
>>2.0237842876e+304
How to generate floats from 0 - MAX(float) or MIN(float) to MAX(float)?
Aucun commentaire:
Enregistrer un commentaire