我使用Math.floor((Math.random()* max-min)+ min)生成随机数,这个函数和random.nextDouble()有什么区别?如何在Javascript中实现random.nextDouble?
1.
var min = 99; var max = 101; Math.floor(Math.random() * (max - min)) + min; //random int from min to max (not including)
需要将int转换为double。