During coding in JavaScript, you may need to add a random factor to the whole thing. This tutorial will show you how.
The first half of the video is explanation of the code, while the second half contains examples. Feel free to skip around if you only want to see one part or another.
Original source
11 responses to “JavaScript Tutorial: Random Numbers”
Can you please help me to understand the PURPOSE of using random numbers? I am teaching this for the first time and I am a visual learner. I have to see the end result. Thank you!! Great video!
Great great video!
this html…
this code would generate random number min number is 0 and max is 99 correct?
var randomNumber = Math.floor(Math.random() * 100);
console.log(randomNumber);
How would I get a random number from something like 10 – 25
nice video I am looking random number with no repeat number please paste your code
How can I get a random number from any random number?
Instead of Math.Ceil -1, Math.Floor might be better for arrays since it rounds down instead of up. Is there a reason why this wouldn't work?
Your video kind of helped with a project in one of my classes but I have a different problem. The problems is that I have is that I have a drop down menu that I want to connect arrays of different types to them. So the end produce is that someone could pic a thing from the drop down menu and hit a button then a random name will come up.
nice, very helpfull!
nice guide!