本文介绍了util.Random中的种子是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解种子的含义. http://docs.oracle.com/javase/7/docs/api/java/util/Random.html"rel =" nofollow noreferrer> java.util.Random 吗?我已阅读为什么此代码会打印"hello world"?问题而且我仍然对种子感到困惑.有人能友善地描述我种子的实际含义吗?谢谢.

I can't understand what was the meaning of Seed in java.util.Random ? I had read Why does this code print "hello world"? question and I am still confuse about seed . Can anyone describe me kindfully what was seed actually mean ? Thanks.

在 setSeed()方法... seed - the initial seed是什么意思?

In documentation for setSeed() method ... what does mean seed - the initial seed ?

如果我能完全理解seed的含义,我希望我会清楚地理解答案.

I would expect if I can understand exactly meaning of seed , I am sure I will understand clearly to this answer.

推荐答案

播种显式初始化此状态. 种子"是一个开始 点,从中生长出某种东西.在这种情况下, 数字.

Seeding explicitly initialises this state. A 'seed' is a starting point, from which something grows. In this case, a sequence of numbers.

这可以用于始终生成相同的序列(通过使用 已知的常数种子),这对于确定性很有用 行为.这对于调试,对于某些网络应用程序来说非常有用, 密码学等.

This can be used either to always generate the same sequence (by using a known constant seed), which is useful for having deterministic behaviour. This is good for debugging, for some network applications, cryptography, etc.

或者,在您希望行为不可预测的情况下 (每次您运行程序或打牌游戏时总是有所不同), 您可以使用可能不断变化的数字作为种子,例如 时间.

Or, in situations where you want the behaviour to be unpredictable (always different each time you run a program, a card game perhaps), you can seed with a number likely to be continually changing, such as time.

序列的随机性"不取决于所选择的种子, 尽管它确实取决于不重新播种序列.

The 'randomness' of the sequence does not depend on the seed chosen, though it does depend on not reseeding the sequence.

来自

这应该回答您的问题.

这篇关于util.Random中的种子是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 01:30