开发者

Is Java's RNG (using seeds) platform-independent?

开发者 https://www.devze.com 2022-12-16 02:59 出处:网络
Apologies in advance for asking a (seemingly obvious) question.I 开发者_开发问答haven\'t found an answer online, so I figured I\'d ask:

Apologies in advance for asking a (seemingly obvious) question. I 开发者_开发问答haven't found an answer online, so I figured I'd ask:

Is Java's Util.Random platform-independent?

For Example, is new Random(50) going to produce the exact same sequence of random numbers in both *nix and Windows systems?


From 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号