Math.random

发现自己总是不记得随机数怎么写。所以在这里写下几个:

1.parseInt(Math.random()*(12)+1);//1~12

2.parseInt(Math.random()*(6)+1);//1~6

3.总结parseInt(Math.random()*((max+1)-min)+min);//min~max

原文地址:https://www.cnblogs.com/huangqiming/p/5977610.html