Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Get random word from prompt imput Re: Get random word from prompt imput

#126650
DADE
Participant

@tomrogers123
You random number calculation is wrong.

// This will never give you 2. Only 0, 1
Math.floor(Math.random()*2);

// This will give you 0-2 outcomes
Math.round(Math.random()*2);
Math.floor(Math.random()*3);