Post Reply 
WP34S: Question about Ran# in integer modes
12-18-2013, 08:33 PM
Post: #1
WP34S: Question about Ran# in integer modes
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?
Find all posts by this user
Quote this message in a reply
12-18-2013, 09:39 PM
Post: #2
RE: WP34S: Question about Ran# in integer modes
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:-/
Find all posts by this user
Quote this message in a reply
12-19-2013, 07:48 AM
Post: #3
RE: WP34S: Question about Ran# in integer modes
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
Find all posts by this user
Quote this message in a reply
12-19-2013, 08:08 AM (This post was last modified: 12-19-2013 08:10 AM by eri.)
Post: #4
RE: WP34S: Question about Ran# in integer modes
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.
Find all posts by this user
Quote this message in a reply
12-19-2013, 09:11 AM (This post was last modified: 12-20-2013 06:20 AM by Paul Dale.)
Post: #5
RE: WP34S: Question about Ran# in integer modes
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
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)