View Single Post
  #9 (permalink)  
Old 07-21-2008, 02:50 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 17
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Random.. not actually random

An ideal seed?

Something like time, which will vary constantly. Even if you use the given C/C++ time function, you are returned the seconds past midnight, so that will change every second. That should be good enough for most of our random number needs.

Another possible seed is the amount of virtual memory currently being used, which is going to be varrying quite a bit.

The size of a file in a computer's root drive, or the system folder. You could set it to go through like 10 or 15 files with a for statement or something so you won't be getting the first one. Although in many circumstances it won't matter.

The number of files in a given directory, maybe not the best choice.

Those are some examples, stuff that varies constantly is usually a good choice. And depeneding on how you need to use the random number it can just be stuff that varies from computer to computer.

If you google good random number seeds there will be alot more there than what I had to say. And also if you look into polymorphism it will give you some examples of what to use as a random number seed.
Reply With Quote