I need help on this project for my friend

Math.random() doesn’t take any parameters. It just generates a number between 0 and 1. So round function produces either 0 if number is < 0.5 or 1 if > 0.5.
In order to generate a random number between 0 and 2 do like this:

var ranInt = Math.round(Math.random() * 2);

Browse More Popular Posts

Leave a Comment