生成随机数


Math.round(Math.random())

解释:

Math.random():返回介于 0(包含) ~ 1(不包含) 之间的一个随机数

Math.round():返回四舍五入最接近的整数