Steven:
        Thanks for the suggestion. You were correct. The divide by zero error
was not in the random number generation but was in fact in a later
handler where in fact division does occur.
        I must say that I like your random generator much better than mine.
Avoids the repeat loop and potential problems there. I don't follow what
you meant by "If you need to include both bounds in the range of values,
use random(30000) instead of random(30000)-1." Do you mean that if I
want to sometimes actually get the preset gupper as a value I use
"random(3000)"?
        Thanks
        Rick

you wrote---
I can't see anywhere you can get a divide by zero error in this script,
unless there is a bug in the random function. But I suspect there is an
easier way to do this:

function myRandom lower,upper
   return trunc((random(30000)-1)/30000 * (upper - lower)) + lower
   -- returns a whole number R,  lower <= R < upper
end myRandom

30000 isn't a particularly special number, I just pick it because it is
large, thus giving myRandom a fairly high resolution.

If you need to include both bounds in the range of values, use
random(30000) instead of random(30000)-1.

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to