Post Reply 
Possible issues with random number generators for calculator apps
04-18-2017, 10:48 PM
Post: #1
Possible issues with random number generators for calculator apps
I was reading "Thinking Fast and Slow" by 2002 Nobel prize winner Daniel Kahneman. In one of his chapters he talk about how researchers can be deceived by small samples. The author says that small samples don't necessarily mimic their large sample counterparts and can show the illusion of patterns.

This conclusion made me think about PRNGs for calculator apps where the number of random number generated is usually small. Might this mean that no matter how good the PRNG algorithm used is, the random numbers generated may depict a false pattern? In most cases, such patterns may have little impact on the calculator apps or games.

Your thoughts?

Namir
Find all posts by this user
Quote this message in a reply
04-18-2017, 11:14 PM (This post was last modified: 04-18-2017 11:21 PM by pier4r.)
Post: #2
RE: Possible issues with random number generators for calculator apps
Well I am reading just now your topics about rng (page 30-35 of this forum). Nice work with excel and Matlab (why not on the calculators?)

From there I checked the rng of the family "linear congruent" and they do have a fixed pattern (in parallel planes). Their usage should be fine for small, non crucial, applications.

Namir side questions for you : while I believe that whatever personal exploration is important for understanding a topic, your "new" algorithms are really new or are labeled as "new" as in "I searched for a while and I did not find anything similar?" (this would be still a problem, how does one know if he has searched enough? Is one searching day enough? Ten? One thousand?)

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
04-19-2017, 01:09 AM
Post: #3
RE: Possible issues with random number generators for calculator apps
The problem is that small samples do not look like large samples. Taking sequences of coin flips as an example, a string of 10 heads in a random sample of size 15 is rather remarkable; a sequence of 10 heads in a random sample of size 1500 is nearly certain. Long random strings contain lots of non-random-looking short strings. Good PRNGs easily generate this behavior. The problem is inherent in "random" behavior.

I posted (I think three) pretty good generators for the HP50g somewhere on this board. They consist of a Tausworthe (shift-register) generator combined with a long linear contruential generator. (Each generator "sees" the other as a non-linear sequences.)

I personally prefer to design each "random looking" simulation to have provably independent parts where necessary. It's a bit of work but the results are good. Of course, short runs don't look very random anyway.
Find all posts by this user
Quote this message in a reply
04-19-2017, 11:00 AM
Post: #4
RE: Possible issues with random number generators for calculator apps
(04-18-2017 11:14 PM)pier4r Wrote:  Well I am reading just now your topics about rng (page 30-35 of this forum). Nice work with excel and Matlab (why not on the calculators?)

From there I checked the rng of the family "linear congruent" and they do have a fixed pattern (in parallel planes). Their usage should be fine for small, non crucial, applications.

Namir side questions for you : while I believe that whatever personal exploration is important for understanding a topic, your "new" algorithms are really new or are labeled as "new" as in "I searched for a while and I did not find anything similar?" (this would be still a problem, how does one know if he has searched enough? Is one searching day enough? Ten? One thousand?)

The test for randomness requires fast machines and software. I use Matlab for speed, because I usually generate a few billion random number in testing a set of algorithms.

I post new algorithms that I develop myself. I have been looking at root-seeking algorithms sine the mid 70s, so I have a good idea of what's out there. I did post recently a survey of new modifications for Newton's method created by others. I usually don't search for similar algorithms. Now that you have mentioned that subject, I officially appoint you as algorithm searcher!! I will stick of thinking of new algorithms :-)

Namir
Find all posts by this user
Quote this message in a reply
04-19-2017, 11:51 AM (This post was last modified: 04-19-2017 11:55 AM by pier4r.)
Post: #5
RE: Possible issues with random number generators for calculator apps
Hi Namir. I did not want to criticize, and I believe I explained myself in a not so clear way so now I try again with more sentences.

I believe that exploring known subjects is crucial for a person, since knowledge and experience cannot be passed with a cable like in Matrix, one that wants to learn a new subject has to go through it as several people did before him/her. Only then one can hope to produce new contributions or maintain -- for example in a library -- the existing ones.

Said that there is another big problem that I never saw solved in my life. When one has a question I see at least the following ways to find a possible answer: (a) work on the question by himself and (b) ask the others (internet communities, professors, friends, books, search engines, whatever).

Now (b) is complicated. Because could be that the answer is known, but it is not known by the persons (or references) used in (b). Or could even be that the answer is in present in (b) - for example in a book chapter - but the person does not find it (this happens often to me, that I miss information in the AUR of the 50g or the user guide).

Therefore one has always to estimate the trade off: Is better that one spends energy searching or is better that one tries by him/herself? And when one searches, how long should s/he search? This I meant when I wrote "Is a searching day enough? Ten? One thousand?"

My partial solution to the problem is: I ask around if something I want to know/do exist, and in the meanwhile I work on it nevertheless. The I label it as "new, at least for me".

If you then say that you work on those subjects since tens of years, it is likely that you know that those are really new. (Another side question: what about publishing them in a journal?)

Said that, I remember a nice idea that I read 5+ years ago on another forum. Whatever the contribution, even if was the n-th duplicate, it could be always the first "door" on the concept behind the contribution for another person. I have to say that some of your publications are "first doors" for me, especially on the random numbers generators and their structure.

Therefore, even if my feedback is of little value, I would say that I find your efforts interesting!
Just one nitpick. Your older articles where in html form, that is easy to consume on a smartphone. Then you published pdf-s, still ok. Then zipped files with pdf-s inside, that is a bit cumbersome to consume as a reader. Could be possible to leave the pdf always outside the zipped package, so one can download first the pdf and then in the case the complete package?

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
04-19-2017, 01:54 PM
Post: #6
RE: Possible issues with random number generators for calculator apps
This is relevant:

http://dilbert.com/strip/2001-10-25

Just yesterday, I wrote a quick-and-dirty dice program on a TI-80 I had handy to play a game, and damned if the results didn't look awfully skewed. But were the results really skewed? I'd probably have to play a few thousand more games to have a better idea. Smile

I recall reading that Apple had to modify the shuffle algorithm in iTunes/iOS, effectively making it less random, in order to make it appear more random to users.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-19-2017, 02:05 PM
Post: #7
RE: Possible issues with random number generators for calculator apps
@Dave Britten.

Nice game! I'm interested, are there the rules somewhere? I may do my own (maybe directly on the 50g)

For the apple itunes. True. Gladiabots (a programming game for android) has the same problem in choosing random maps, sometimes it is infuriating.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
04-19-2017, 02:35 PM
Post: #8
RE: Possible issues with random number generators for calculator apps
(04-19-2017 01:54 PM)Dave Britten Wrote:  I recall reading that Apple had to modify the shuffle algorithm in iTunes/iOS, effectively making it less random, in order to make it appear more random to users.

Nobody believed the same song played twice in a row can be random...
Find all posts by this user
Quote this message in a reply
04-19-2017, 03:27 PM
Post: #9
RE: Possible issues with random number generators for calculator apps
(04-19-2017 02:05 PM)pier4r Wrote:  @Dave Britten.

Nice game! I'm interested, are there the rules somewhere? I may do my own (maybe directly on the 50g)

For the apple itunes. True. Gladiabots (a programming game for android) has the same problem in choosing random maps, sometimes it is infuriating.

Yup, just hit the Files link. That's where you'll find the materials and rules for most of the print-and-play games on BGG.

https://www.boardgamegeek.com/boardgame/...aire/files
Visit this user's website Find all posts by this user
Quote this message in a reply
04-19-2017, 05:09 PM
Post: #10
RE: Possible issues with random number generators for calculator apps
The Ti series of MSP432 processors has a 128 bit random number programmed into the device:
"The random number stored as a seed for a deterministic random number generator is programmed during
test of the device. It is generated on the test system using a cryptographic random number generator."

Humans are really bad at understanding random numbers. That is why casinos are so rich.
Find all posts by this user
Quote this message in a reply
Post Reply 




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