Java-常用包与函数

Math.random()

Math.random()会返回一个[0.0,1.0)的双精度浮点数

(Math.random()*51)就是返回一个[0.0,51.0)的双精度浮点数

固:(int)(Math.random()*51)是返回[0,50]的随机整形