Math.random() 取得的随机数是0~1之间的小数
如果乘于10就得到0~10的随机数了

解决方案 »

  1.   

    *是乘号
    public static double random()
    Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range. 
    double再转化成int就得到0到high-1之间的随机数了