Pat Adams wrote:
However, in answer to your question, there is no way to get TRUE
randomness in a computer system. Even cryptographically secure random
number generators can be predicted under absolutely identical
circumstances.
While technically that is true, there is a method that will give what I
think is a very random number and is extremely unlikely to produce the
same sequence. What you do is seed the random number generator with an
integer based on the system time. Unless the random number is generated
at the same time every day, you will have very random out put. If it is
done at the same time every day you can use the date as part of your
seed. Depending on the frequency at which these random numbers need to
be generated, you may wish to use fractions of a second or just seconds.
There are also several places that you can get a reasonably random
number for the seed from your machine. The amount of free disk space,
unless that doesn't change much on your machine. The amount of free
RAM, (up time mod cpu usage). Any number of things could be used that
are not very predictable, if at all.
--
Chris W
Gift Giving Made Easy
Get the gifts you want &
give the gifts they want
http://thewishzone.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]