首页 > 其他分享 >random 产生随机数

random 产生随机数

时间:2022-12-21 15:45:24浏览次数:41  
标签:info 5.2 console 产生 random _. 随机数 between


console.info(_.random(0, 5));
// => an integer between 0 and 5
 
console.info(_.random(5));
// => also an integer between 0 and 5
 
console.info(_.random(5, true));
// => a floating-point number between 0 and 5
 
console.info(_.random(1.2, 5.2));// 设置 true false都会是浮点数;
// => a floating-point number between 1.2 and 5.2

标签:info,5.2,console,产生,random,_.,随机数,between
From: https://www.cnblogs.com/pansidong/p/16996392.html

相关文章