Post Reply 
Little explorations with HP calculators (no Prime)
04-15-2017, 05:34 AM
Post: #186
RE: Little explorations with the HP calculators
(04-14-2017 12:26 PM)John Keith Wrote:  
(04-14-2017 08:53 AM)ttw Wrote:  If you use Joe Horn's code to shuffle the list, a single shuffle is completely random. A new shuffle would give you a new ordering. What his code does is place the any element into slot 1, then any remaining element into slot 2, etc.

That is a classic algorithm: Fisher-Yates shuffle

Actually, no. Fisher-Yates is a method for shuffling an already-existing array. So it requires two loops: one to generate the array, and another to shuffle it. My method doesn't do that; it shuffles the array WHILE creating it, all in one loop. In the Wikipedia article cited above, that's called "The Inside-Out Algorithm". The article unfortunately gives no name for its discoverer, nor date for its discovery.

X<> c
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Little explorations with the HP calculators - Joe Horn - 04-15-2017 05:34 AM



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