Random numbers
Posted: Mon Nov 12, 2007 7:30 am
It seems that rand function doesn't accept arguments greater than 32768. Or, more precisely, it treats any larger number as this one. Very confusing. More than, (rand n) seems to be implemented as (% (rand 32768) n), which is good for big ranges, but is a very poor solution for a 15-bit range. (E.g. average of a million (rand 10000) samples is 4650, not 5000). In fact I have a bad feeling that the random number generator used in newLISP has much more sins which made it really unusable. Now I am trying to rewrite random.py module from the standard Python library to newLISP. It has rather good reputation.
P.S. I am using Win32 port of newLISP, maybe other platforms have better random numbers.
P.S. I am using Win32 port of newLISP, maybe other platforms have better random numbers.