Math.random() 生成的是 [0,1) 区间的伪随机数,通过乘以区间差并配合 Math.round、Math.ceil 或 Math.floor 可实现指定范围的整数随机数。利用 Number.prototype. 阅读全文