realbasic-nug
[Top] [All Lists]

Re: random seed generator?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: random seed generator?
From: Jonathan Johnson <jonj at realsoftware dot com>
Date: Wed, 29 Nov 2006 16:13:39 -0600
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <21238198-7650-4FF8-A2A5-2CC3FCC0128B at comcast dot net> <49963 dot 217 dot 125 dot 94 dot 125 dot 1164837597 dot squirrel at webmail dot tssystems dot net> <2EE49F9A-97C2-4394-A1E6-8E67CEF774F4 at comcast dot net>

On Nov 29, 2006, at 4:03 PM, Michael wrote:

I am trying to use d.totalseconds as a seed, but not getting anywhere.
totalSecs is a double, so try as I might, I cannot successfully convert the double to an integer without it getting all messed up.
Random.org defeats the purpose of what I am trying to do.

TotalSeconds is the number of seconds since January 1, 1904 at 12:00:00 AM. This, as you might have guessed, is larger than the biggest Int32 value, which means that when converting you will be capped at 2^31-1.

You can try using Ticks() instead, which is based on uptime, or you could try using a closer reference date by subtracting the reference date's total seconds from the current total seconds.

HTH,
Jon


--
Jonathan Johnson
jonj at realsoftware dot com
REAL Software, Inc.


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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>