At 15:19 -0500 2004/11/10, [EMAIL PROTECTED] wrote:
You could accomplish the same thing by something like this.
NUM1 = RND(33000)
NUM2 = RND(33000)
RNDNUM = (NUM1"R%4":NUM2"R%4") + 0

thus taking only the 4 rightmost digits of each.

You definitely shouldn't do this. Default RNG's are crappy to begin with and the low-order bytes are the least random. This may give you an apparent uniform distribution (I'd expect gaps even you nearly exhaust the period of the RNG), but you'll definitely get hit by low-order serial correlations.


There's a really good section in "Numerical Recipes for C" on pseudo random number generators. There's also a bit about doing 64-bit math in two 32-bit numbers, which would be especially applicable for the OP's Win32 implementation. I remember finding this chapter on the web in PDF format a while back. Hopefully it's still out there.

Ray


-- .=================================================================. | =-=-=-=-=-=-= Eagle Rock Information Systems Corp =-=-=-=-=-=-= | | -=-=-=-=-=-=- web and database business solutions -=-=-=-=-=-=- | | <http://www.eriscorp.com> <mailto:[EMAIL PROTECTED]> | |Midwest Regional Office: 815-547-0662 (voice) 503-905-8153 (eFax)| .=================================================================. ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to