Random伪随机
Random生成的随机数都是伪随机数,也就是说生成的随机数是有依据可循。
查看Random源代码:
public Random() {this(seedUniquifier() ^ System.nanoTime());}private static long seedUniquifier() {// L'Ecuyer, "Tables of Linear Congruential Generators of// Different Sizes and Good Lattice Structure", 1999for (;;) {long current = seedUniquifier.get();long next = current * 181783497276652981L;if (seedUniquifier.compareAndSet(current, next))return next;}}
其中System.nanoTime() 是与系统时间无关的纳米维度时间,和CPU和线程有关
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
