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 work!
Your idea works perfectly.  The mathematics is correct.
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'd get random numbers from 5 to 8 digits long, and thus in the range 1 - 
1000
You could then subtract 1 if you want the range
0 - 999
Will
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


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 this.
NUM1 = RND(33000)
NUM2 = RND(33000)
RNDNUM = (NUM1R%4:NUM2R%4) + 0

thus taking only the 4 rightmost digits of each.
You'd get random numbers from 5 to 8 digits long, and thus in the range 1 - 
1000

You could then subtract 1 if you want the range
0 - 999

Will
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/