JavaScript 在两个数字之间随机
示例
返回介于min和之间的随机整数max:
function randomBetween(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}例子:
//randomBetween(0,10); Math.floor(Math.random() * 11); //randomBetween(1,10); Math.floor(Math.random() * 10) + 1; //randomBetween(5,20); Math.floor(Math.random() * 16) + 5; //randomBetween(-10,-2); Math.floor(Math.random() * 9) - 10;
热门推荐
1 泰迪狗狗如何训练
3 狗狗训练图
5 狗狗训练方法
6 训练狗狗不咬人
8 敏捷训练狗狗
10 训练狗狗吃饭
11 泰迪狗狗训练
12 狗狗从多大开始训练
13 狗狗训练学校费用
14 怎么去训练狗狗
15 狗狗训练狗狗
16 狗狗训练教程
17 训练狗狗装死
18 泰迪狗狗的训练方法