js获取随机数

获取A至B之间的随机数:

Math.random()*(B-A)+A

例如:
获取1000至9999之间的随机整数:

Math.floor(Math.random()*8999+1000)

发表评论

邮箱地址不会被公开。 必填项已用*标注