??? 10/04/04 07:04 Read: times |
#78666 - RE: seeding random number generator Responding to: ???'s previous message |
hi,
The reason is that any random number generator on a computer will produce what are called pseudo random numbers because it will always produce the same sequence of numbers Yes, that is good and bad thing at same time. There are applications in which user needs that each time it runs, software generates the same sequence of pseudo-random numbers. For example, it may be used for crypt/decrypt, for analysis of a function, just for generate the defined sequence instead of usage of huge lookup tables. From other side, for some tasks it needs to hide that random numbers are pseudo ones. For example, some of my projects are made for gambling. It is not useful to use true-random generators there. All games use pseudo-random generators, for example ones based on LFSRs. But every time after power-on it runs the same sequence. What we do? Just save its value after each shift into non-volatile memory and restore the last value at power-up. Another problem comes because some "bad" users try to find parameters of the LFSR (number of bits, loop-back taps etc). Once it is determined, LFSR may be easy calculated for any number of next steps. What we do then? We use a few LFSRs with different parameters and switch between them with true-random factor. For example, switch based on time between any two button pressed, etc. Here is example, how both true-random and pseudo-random generators may be used together. Regards, Oleg |