dimanche 26 avril 2020

Math.random() generates a number greater than 1 [duplicate]

I created a variable to display and then to display it

double randomNumber = Math.random(); System.out.print(randomNumber + "\t");

One of the results was 8.791603511049129E-5 Isn't Math.random() supposed to generate a number greater than or equal to 0.0 and less than 1.0? How come it was higher?




Aucun commentaire:

Enregistrer un commentaire