为提出(似乎很明显)的问题提前道歉.我没有在线找到答案,所以我想我会问:
Java的Util.Random平台是否独立?
例如,新的Random(50)将在* nix和Windows系统中产生完全相同的随机数序列?
解决方法
从
the docs:
If two instances of Random are created with the same seed,and the same sequence of method calls is made for each,they will generate and return identical sequences of numbers. In order to guarantee this property,particular algorithms are specified for the class Random . Java implementations must use all the algorithms shown here for the class Random ,for the sake of absolute portability of Java code.
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|