What is meant by a seed in random number generation?

☆樱花仙子☆ 提交于 2019-12-02 15:05:08

问题


Though I have referred about the meaning of seed in google,I can't get the exact answer that I want.Can anybody explain with an example?


回答1:


It's an initial value for a random number generator to base its sequence of random numbers on. If you seed two random number generators with the same value, they'll produce the same sequence of numbers. This is useful for testing purposes. In production, you typically seed a random number generator with a value that's hard to guess, like the millisecond value from your system clock.




回答2:


A seed is used to initialize a pseudorandom number generator. It is a starting point for all random numbers to be generated. If you initialize a PRNG with the same seed, for example a number 100, you will always get the same numbers generated and the results will be deterministic (that can be useful for testing). If you initialize the PRNG with a variable value, for example a timestamp, you should get different results with high probability (used in production). Refer to:

http://en.wikipedia.org/wiki/Pseudorandom_number_generator

http://en.wikipedia.org/wiki/Random_seed



来源:https://stackoverflow.com/questions/22915400/what-is-meant-by-a-seed-in-random-number-generation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!