Here's a very basic issue that i cannot resolve on my mind:
In JS if i do:
Math.random() i will get random numbers between 0 and 1 (including 0, not including 1)
So, if i do Math.ceil(Math.random() * 100) i will get random numbers between 0 and 100. Am i right?
I will get 0 if Math.random() was exactly 0, which is possible as i read in the documentation.
However I read everywhere that doing this "Math.ceil(Math.random() * 100)" i will get numbers between 1 and 100.
Please, can someone clarify this situation?
Thanks!
Math.random () -> [0; 1) Math.ceil(Math.random()) -> [0; 100]
Aucun commentaire:
Enregistrer un commentaire