WP34S: Question about Ran# in integer modes - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not quite HP Calculators - but related (/forum-8.html) +--- Thread: WP34S: Question about Ran# in integer modes (/thread-157.html) |
WP34S: Question about Ran# in integer modes - eri - 12-18-2013 08:33 PM I figure I can get random bits by switching to base 2, then hitting ran#, or change to base 6 and I can use the digits in place of a 6 sided dice. When I do this and sum a random walk of various bits - or of all bits - the variance seems too small. The walk seems to land too close to zero to be uniform random. I glanced at the source code and the calculator is using a tausworthe generator from gnu science lib so either I'm testing the numbers incorrectly or the output is not what I assumed it was. Are digits uniform random when in an integer mode (base x)? Also, how to I read and set the seed for the random generator? RE: WP34S: Question about Ran# in integer modes - walter b - 12-18-2013 09:39 PM Quote:how to I read and set the seed for the random generator?To set, use SEED (see p. 112 of the printed manual). I don't know a way to read the seed though. d:-/ RE: WP34S: Question about Ran# in integer modes - Paul Dale - 12-19-2013 07:48 AM In integer mode, the random number generator is producing a sixty four bit random number using two sequential calls to the Tausworthe generator . This is then truncated and made unsigned according to the current mode (which will lose the sign bit and can change the bit pattern). In binary or equivalent bases (4, 8 or 16), the digits should be completely random (at least in unsigned mode and most likely in all other modes). In other bases, there will be some small bias. Additionally, a shorter word length will increase the bias typically. - Pauli RE: WP34S: Question about Ran# in integer modes - eri - 12-19-2013 08:08 AM Thanks Paul, that's what I wanted to know. I see it there in stats_random. I was looking for handling of non-power of 2 bases. Why not handle that in the source? Ok, I must be testing wrong. I'll try it on desktop for real. RE: WP34S: Question about Ran# in integer modes - Paul Dale - 12-19-2013 09:11 AM Is it really worth the space cost to provide non-binary base uniformly distributed random numbers? Use real mode, multiply and switch to integer. - Pauli |