Here's the deal. PRNG uses strictly defined function for generating it's next value, specifically:You don't give any explanation
Code: Select all
#define RAND_MAX 0x00010000 /* that would be 65536 */
static unsigned int seed = 1;
void srand ( int s )
{
seed = s;
}
unsigned int rand ( void )
{
seed = seed * 0x00FACEXD + 0xDEADBEEF;
return seed % RAND_MAX;
}
(this is almost line-to-line ripped from glibc, and msvcrt uses exactly the same)
This makes it obvious why same seed gives same sequence. This would be quite good enough, nevertheless it may be not. To increase entropy, you must interfere with an algorithm, particularry by modifying at random multiplication and addition values, or just the seed itself. To do that, you must somehow find a data that could not be predicted, i.e. being really random. Hardware random generators has noise generators which naturally source them truily random stream of data. Software emulation must gather "noise" from some of the sources available. One of such sources is user input. The other is natural fluctiations in program execution flow.
The whole point to use it in games is so the player won't see any pattern, not encryption or something.A player won't try to guess what the (P)RNG will give.
In general, yes, you can't. But if you can't exactly predict how many times random is called between randomization, then it does increases entropy.I don't think you can increase the entropy of a random stream by seeding its own randomness to itself
Probably. It was supposed to set new seed at random.math.randomseed ( math.random ( ) ) is the same as math.randomseed(0) by the way. I guess you meant something different.