vendredi 15 décembre 2017

Does randomIO (from System.Random) ever produce 0?

I understand that randomIO::IO Float produces uniformly distributed Float numbers, but my question is in what range? Is it [0,1], (0,1) or anything in between ([0,1) or (0,1])?

I couldn't find anything about it on hackage, and the referenced paper is behind a paywall.

The reason I'm asking is because you might want to transform the random number, and if you want to evaluate 1/myRandomNumber it would be helpful to know wheter you will ever run into Infinity or not.

import System.Random
main=(randomIO::IO Float)>>=print

Try it online!




Aucun commentaire:

Enregistrer un commentaire