First page Back Continue Last page Image
- Essential to computer games and some non-game applications is the ability for the computer to generate a random number
- In JavaScript the random function is part of the JavaScript math library
- var newNum = Math.random();
- While the code above will give you a random number, it will be between 0 and 1, so to make it useful you will need to adjust it a bit