samedi 8 octobre 2016

How to generate random number with a large number of decimals in Python?

How it's going?

I need to generate a random number with a large number of decimal to use in advanced calculation.

I've tried to use this code:

round(random.uniform(min_time, max_time), 1)

But it doesn't work for length of decimals above 15.

If I use, for e.g:

round(random.uniform(0, 0.5), 100)

It returns 0.586422176354875, but I need a code that returns a number with 100 decimals.

Can you help me?

Thanks!




Aucun commentaire:

Enregistrer un commentaire