使用Math.floor与Math.random取随机整数的方法详解
Math.random():获取0~1随机数Math.floor() method rounds a number DOWNWARDS to the nearest integer, and returns the result. (小于等于 x,且与 x 最接近的整数。)其实返回值就是该数的整数位:Math.floor(0.666) --> 0Math.floor(39.2783) --> 39所以我们可以使用Math.floor(Math....