HP Forums

Full Version: WP34S: Question about Ran# in integer modes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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:-/
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
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.
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
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :