Create a random number
Fri Apr 21 2023 17:47:39 GMT+0000 (Coordinated Universal Time)
Saved by
@AlanaBF
#javascript
//Random Number Generation
var n = Math.random();
console.log(n);
//number will be between 0 and 0.9(to 16 decimal places)
//this will give 0-6 s adding 1 to every answer gives the numbers on a dice
//multiply by whatever range you need
n = n * 6;
n = Math.floor(n) +1;
//called a pseudo random number generator
content_copyCOPY
Comments