Random类和Math.radnom()方法的联系

来源:互联网 发布:手机 惯性导航算法 编辑:程序博客网 时间:2024/04/24 23:30

<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"></span><pre name="code" class="java"> public static double random() {        Random rnd = randomNumberGenerator;        if (rnd == null) rnd = initRNG();        return rnd.nextDouble();    }

math.Random方法底层实现使用了Random类。


 public static double random() {
        Random rnd = randomNumberGenerator;
        if (rnd == null) rnd = initRNG();
        return rnd.nextDouble();
    }

0 0
原创粉丝点击