Re: [U2] [UV] Random number (RND()) help

2004-11-17 Thread Craig Bennett
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

RE: [U2] [UV] Random number (RND()) help

2004-11-16 Thread Raymond DeGennaro II
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 = (NUM1R%4:NUM2R%4) + 0 thus taking only the 4 rightmost digits of each. You definitely shouldn't do this. Default RNG's are crappy to begin

Re: Unclassified RE: [U2] [UV] Random number (RND()) help

2004-11-11 Thread Dianne Ackerman
I always multiply the random number generated by the system time in my programs -Dianne [EMAIL PROTECTED] wrote: So, how could you generate random numbers larger than 32K? Call RND twice, multiply the first number by 32762 and add on the second number? Probably lousy mathematics, but it might

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Maresh, Mel
I ran your code on UV 10.1 on AIX and the highest number generated was 370558 I don't think it's your code Mel UV 9.6.1.3 on NT. I needed to generate some random numbers between 0 and 370570, and just to check the distribution of numbers, I ran this snippet of code: FOR I = 1 TO 99

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Glenn Herbert
The RND function has an upper limit of (2 ** 15) - 1, such that the range can be 0 to 32767. High order bits are dropped. The documentation does indicate that the value within the parenthesis is the total number of integers, including 0, from which the random number can be selected; what it

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Glenn Herbert
Oh yes. That is the limitation on 32-bit Windoze. Your numbers WILL differ on UNIX systems. At 02:36 PM 11/10/2004, you wrote: I ran your code on UV 10.1 on AIX and the highest number generated was 370558 I don't think it's your code Mel UV 9.6.1.3 on NT. I needed to generate some random

Unclassified RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread HENDERSON MICHAEL MR
UV 10.0.15 ON Windows 2003 server Largest RND returned is 32767 Hmm Looks like the docco under HELP BASIC RND should say Use the RND function to generate any positive or negative random 16-bit integer or 0 So, how could you generate random numbers larger than 32K? Call RND

Re: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Ray Wurlod
I suspect from your description that the argument for RND() is a signed Small Integer (0 through 32767). Don't know why this is. Manual doesn't seem to help. Ask IBM. Workaround is something like 32768 * Rnd(32767) + Rnd(32767). - Original Message - From: Barry Brevik [EMAIL PROTECTED]

Re: [U2] [UV] Random number (RND()) help

2004-11-10 Thread FFT2001
UV 9.6.1.3 on NT. I needed to generate some random numbers between 0 and 370570, and just to check the distribution of numbers, I ran this snippet of code: FOR I = 1 TO 99 THIS.NUM = RND(370570) NEXT Add this line to the top PRECISION 0 and try it again. Will --- u2-users mailing list

Re: Unclassified RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread FFT2001
So, how could you generate random numbers larger than 32K? Call RND twice, multiply the first number by 32762 and add on the second number? Probably lousy mathematics, but it might work! Your idea works perfectly. The mathematics is correct. You could accomplish the same thing by something like

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Stevenson, Charles
Barry, On UV10.0.16, HPUX11i, I get a reasonable distribution: 0001: DIM DISTRIB(10) ; MAT DISTRIB = 0 0002: FOR I = 1 TO 99 0003: THIS.NUM = RND(370570) 0004: DISTRIB( 1+ INT( THIS.NUM/37057 ) )+= 1 0005: NEXT 0006: FOR I = 1 TO 10 0007: CRT

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Tom Dodds
I seem to remember something about 32,767 or 32,768 being involved in this somewhere. Not being a math major, but this is a 8 bit number which I believe is the max for the RND function. You will have to add some other mathematics to reach your 370570. Tom Dodds [EMAIL PROTECTED] 630-235-2975

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Glenn Herbert
That happens because there is special code for the HP: it utilizes a double, not an int. At 03:23 PM 11/10/2004, you wrote: Barry, On UV10.0.16, HPUX11i, I get a reasonable distribution: 0001: DIM DISTRIB(10) ; MAT DISTRIB = 0 0002: FOR I = 1 TO 99 0003: THIS.NUM =

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Allen E. Elwood
limitation on Windoze. *=aee=* -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Glenn Herbert Sent: Wednesday, November 10, 2004 12:01 To: [EMAIL PROTECTED] Subject: RE: [U2] [UV] Random number (RND()) help Oh yes. That is the limitation on 32

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Glenn Herbert
? 243449 ? 253422 ? 282865 ? 33416 ? 351549 Must be a Universe limitation on Windoze. *=aee=* -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Glenn Herbert Sent: Wednesday, November 10, 2004 12:01 To: [EMAIL PROTECTED] Subject: RE: [U2] [UV] Random

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Ray Wurlod
deliberate top post No. UniData and UniVerse are radically different animals wearing a similar skin. /deliberate top post - Original Message - From: Glenn Herbert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: [U2] [UV] Random number (RND()) help Date: Wed, 10 Nov 2004 16:16:21

RE: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Barry Brevik
Workaround is something like 32768 * Rnd(32767) + Rnd(32767). Wouldn't that be *unlikely* to generate numbers less than 32767? Or at least they would be statisticlly skewed away from that lower range. Maybe something like (for numbers between 0 and 370500): ITERATIONS = 1 RND.MAX = 370500

Re: [U2] [UV] Random number (RND()) help

2004-11-10 Thread Results
Workaround is something like 32768 * Rnd(32767) + Rnd(32767). Wouldn't that be *unlikely* to generate numbers less than 32767? Or at least they would be statisticlly skewed away from that lower range. Actually, it wouldn't skew at all. Here's a simple example to prove that 32768 *