javascript怎么生成随机数

2025-04-25 09:10:12
推荐回答(2个)
回答1:

http://www.cnblogs.com/banbu/archive/2012/07/25/2607880.html
去看下

回答2:

使用内置的随机数发生方法:
Math.random(); //该方法产生一个0到1之间的浮点数。
Math.floor(Math.random()*10+1); //1-10
Math.floor(Math.random()*24);//0-23