mardi 28 mars 2017

Can I generate a random float on the whole space ?

I am trying to generate a random number that range from Number.MIN_VALUE to Number.MAX_VALUE, but the following algorithm fails due to buffer overflows (I guess ) :

var randFloat = Math.floor(Math.random() * (Number.MAX_VALUE - Number.MIN_VALUE)) + Number.MIN_VALUE

Is there any way to do it ?




Aucun commentaire:

Enregistrer un commentaire