Talk:Random numbers: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 21:
:: The base of the logarithm could indeed explain the standard deviation; using base 10 instead of base 2 would add a factor of sqrt(1/ln(10)), which indeed is just about 0.66. The second thing to check is the cosine: If MAXScript takes the argument of the cosine in degrees instead of radians, then in the formula the value 2*pi must be replaced by 360.
:: Additional note: Usually floating random number generators give numbers from the interval [0,1) (i.e. 0 included, 1 excluded). However this algorithm needs random numbers from (0,1] (0 excluded, 1 included). It doesn't really matter for b, but for a the value 0 would be fatal (the logarithm isn't defined at value 0). Thus you should check what the random number generator does, and in case it's indeed using the interval [0,1), use <tt>1.0 - random 0.0 1.0</tt> instead. --[[User:Ce|Ce]] 12:26, 21 September 2007 (MDT)
:::Thanks guys, it turned out to be cos expecting degrees rather than radians and I've fixed it now.
:::Thanks guys, it turned out to be cos expecting degrees rather than radians. The documentation of the random generator claims the return values will be inclusive of the arguments, but I tested 1000000000 randoms and got 50 hits on <tt>rand == 1.0</tt> and no hits on <tt>rand == 0.0</tt>. I know the vagaries of floating point comparisons, but as that test took ~20 mins to run, I think it's good enough for this purpose ;o) [[User:Drea|Drea]] 14:19, 21 September 2007 (MDT)
Anonymous user