A key point is the generation of the seed value... Here is a seed
value creation that I got out of a book.
/me not a math guru
to develop seed stuff :)
srand( (time() ^ (time() % $]) ) ^ exp(length($0))**$$);
This snippet is taken from "Perl, The Complete Reference" by Martin C. Brown, published by Osborne pp. 90-91
Update: Why is choosing a unique seed important? rand() generates a sequence of pseudo-random numbers. This implies that the sequence of generation could possibly be predictable or duplicated. A potentially bad situation for an application that requires security.
Intelligent seed generation helps to make that duplication or prediction difficult. That is why good seeds incorporate the use of time() and the current process id, $$.
I've seen other functions that generate the seed value based on prime numbers and other such black magic.... :)
In reply to Re:(fongsaiyuk) Generating Random Integers
by fongsaiyuk
in thread Generating Random Integers
by --OutpostMir--
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |