开发者

What does 'seeding' mean?

Very simple开发者_如何学运维 question. What does the term 'seeding' mean in general? I'll put the context, i.e., you must seed for random functions.


It means: pick a place to start.

Think of a pseudo random number generator as just a really long list of numbers. This list is circular, it eventually repeats.

To use it, you need to pick a starting place. This is called a "seed".


Most random functions that are common on personal computers aren't random, but deterministic to a degree. The 'seed' for these psuedo-random functions are the starting point upon which future values are based. This is useful for debugging purposes: if you keep the seed the same from execution to execution you'll get the same numbers.

To get numbers that are more random a different seed is often used from execution to execution. This is often based on the time of the machine.

This method is completely different than generating a 'true' random number based on some sort of physical property in the world around us. Lava lamps and sun spots are two of the more 'fun' properties that can be observed to generate 'more random' numbers. Anyone can hit http://www.random.org/ to get a real random number if its truly neccessary like for a poker website. If you don't have a good generator folks can attempt to figure out how the generator works and predict future numbers.


Imagine a card game and development of the game program vs. running the game to actually play it.

Pseudo-random number generators use a seed or seeds to determine the starting point of the sequence. Some of them always make the same sequence, others can produce different sequences depending on the seed. Some use a cascade, a simple RNG is given a simple seed, and this is run for a while to produce a more complex seed for the masterpiece RNG.

It is quite useful to be able to deliberately repeat the sequence when developing the program or when one wishes to reproduce previous results.

However, imagine a card game. It's obviously not a good idea to always deal the same sequence of cards.


"Seeding" random function prevents it from giving out the same sequence of random numbers. Think of it as a super-random start of your random generator.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜