1. Use the built-in random number generation method:
2. Based on time, random numbers can also be generated:
var now=new Date();
var number = now.getSeconds()C; //This will generate an integer from 0 to 42 based on the current time.
3. A very excellent random number generator program that can be used in many fields.
Program code