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