Math.floor(Math.random()*(max-min)+min);//取不到max
Math.round(Math.random()*(max-min)+min);//可以取到min,也可以取到max,更合理一点
数据分析师2017-10-01 00:27:59
Teacher, use the floor method for random questions and never take the maximum value. Why not use round? -PHP Chinese website Q&A-Teacher, use the floor method for random questions and never take the maximum value. Why not use round? -PHP Chinese website Q&A
Let’s take a look and learn.