指定范围的随机整数产生方法
摘要:在实际开发中会经常使用指定范围内的随机整数。借助于数学方法,总结出以下两种指定范围内的随机整数的产生方法。 (1)产生0至n之间的随机整数:Math.floor(Math.random()*(n+1)). (2)产生n1至n2之间的随机整数:Math.floor(Math.random()*(n2-
阅读全文
posted @ 2016-09-13 20:19
posted @ 2016-09-13 20:19
posted @ 2016-09-09 22:04