On Mar 3, 2007, at 4:50 PM, Tim Jones wrote: > > On Mar 3, 2007, at 7:15 AM, Robert Woodhead wrote: > >> Random.Seed is a double, not an integer as the documentation would >> have you believe: >> >> http://www.realsoftware.com/feedback/viewreport.php? >> reportid=sjguzxud >> >> Once set, Random.Seed never changes, even as you generate random >> numbers. So you can't easily restart a random number sequence in the >> middle of a set of calls. This is contrary to every other >> implementation of random number generation I've seen in the last, >> oh, 30 years. >> >> http://www.realsoftware.com/feedback/viewreport.php? >> reportid=kspotawy > > To make the seed as random as I can, I use the current "totalseconds" > as the seed value: > > Dim rn As New Random > Dim d As Date > > d = New Date > rn.Seed = d.TotalSeconds > d = Nil > > It's an extra call, but the resulting "randomness" is much less > predictable.
In the last chapter of my declares book at <http://www.declareSub.com/ >, I show how to get a better seed value from /dev/random. It contains the mistake that Robert pointed out -- it sets the seed to an Integer instead of a Double -- but otherwise it works. Charles Yeomans _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
