lundi 26 septembre 2016

Generating random doubles in Jav between 0 and 1 inclusively or [0..1]

Java Math.random() returns a random number in [0..1). Is there a way to make 1.0 inclusive? Eventually I would like to have a random number (floating point number) in a specific range such as [Min..Max]. We know that for integers it will be

Min + (int)(Math.random() * ((Max - Min) + 1))




Aucun commentaire:

Enregistrer un commentaire