Re: Random number generator -- OS X different
Re: Random number generator -- OS X different
- Subject: Re: Random number generator -- OS X different
- From: Richard 23 <email@hidden>
- Date: Tue, 24 Apr 2001 02:54:42 -0700
>
It was brought to my attention by Bill Fancher that when run on OS X,
>
Script A, posted yesterday, gave skewed results.
>
>
After stepping through, I find that the error occurred when OS X rounded
>
the results to a an integer. In Script B, adding 0.5 to the result
>
solves the problem.
>
set ThisNumber to {(the result + 0.05) * 10} as integer
I'm not sure that one should expect much better than "skewed" results
using a single-item list trick to get an integer coercion to work in a
way that I very much doubt it was designed for.
I'm guessing that div, designed to take floating point input returning
and return an integer result would probably be more reliable and
efficient.
set ThisNumber to ((result + 0.05) * 10) div 1
But then I'm probably missing the whole point of this numerical voodoo.
At least you aren't using round!
R23