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.

To refresh the seed and start a new sequence, just get a new date to  
update the TotalSeconds and then reset the seed to this new  
d.TotalSeconds value.  However, you really should only set the seed  
once and then let the nature of the randomizer do the rest.

Tim
--
Tim Jones
[EMAIL PROTECTED]



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to