Post Reply 
Randomize a List problem
09-14-2020, 08:51 PM (This post was last modified: 09-14-2020 09:08 PM by Hlib.)
Post: #4
RE: Randomize a List problem
Quote: John Keith wrote:
... I am not sure that the corrected version of the program does produce all permutations, nor whether the incorrect version is in fact the mistake noted in the linked article. ... Are you sure you have found all the possible permutations that the incorrect version can produce?
For simple cases you can check this manually:
#3: 321 312 231 132
#4: 4321 4312 4231 4213 4132 4123 2431 2413 1432 1423
No matter how many times we run program
<< { 3. 2. 1 } LIST➝ ➝ t
<< 1. t FOR n n RAND × CEIL ROLLD NEXT t ➝LIST >> >>
or
<< { 4. 3. 2. 1 } LIST➝ ➝ t
<< 1. t FOR n n RAND × CEIL ROLLD NEXT t ➝LIST >> >>
we won`t get any other results.
But if ... FOR n t RAND ... then after many clicks we may get all set of lists (6 for #3 and 24 for #4).
Assuming that RAND can take any value from the interval [0,1] and taking into account the specifics of the ROLLD command, I calculated all possible options for the shown results for both versions of the program using the full search method.
There is no error here. But let`s say we can`t be sure. So we need to get the formula.
Quote: Albert Chan wrote:
Random shuffling must produce all permutations with equal probabilities.
We pick a random element from the list, and moved out of the way
Do this repeatedly, like this. (we can skip the 1 element list case) ...
Thank you, but that`s not exactly what I meant. It is easy to randomize the list in different ways, for example, in CASIO-BASIC:
Code:
(Shuffling the List 2)
Seq(Ran# ,K,1,Dim List 2,1)➝List 1
SortA(List 1,List 2):Disp List 2
I was interested in the possibility of describing by formula of the algorithm that was given in the RPL-program.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Randomize a List problem - Hlib - 09-14-2020, 04:38 PM
RE: Randomize a List problem - John Keith - 09-14-2020, 06:08 PM
RE: Randomize a List problem - Albert Chan - 09-14-2020, 07:32 PM
RE: Randomize a List problem - Hlib - 09-14-2020 08:51 PM
RE: Randomize a List problem - Albert Chan - 09-14-2020, 11:41 PM
RE: Randomize a List problem - Werner - 09-15-2020, 06:41 AM
RE: Randomize a List problem - Werner - 09-15-2020, 09:47 AM
RE: Randomize a List problem - Albert Chan - 09-15-2020, 04:36 PM
RE: Randomize a List problem - ijabbott - 09-15-2020, 06:39 PM
RE: Randomize a List problem - John Keith - 09-15-2020, 08:56 PM
RE: Randomize a List problem - Albert Chan - 09-15-2020, 09:34 PM
RE: Randomize a List problem - Werner - 09-16-2020, 06:43 AM
RE: Randomize a List problem - John Keith - 09-16-2020, 11:51 AM
RE: Randomize a List problem - Albert Chan - 09-15-2020, 01:00 AM
RE: Randomize a List problem - Wes Loewer - 09-15-2020, 04:10 AM
RE: Randomize a List problem - John Keith - 09-15-2020, 01:42 PM
RE: Randomize a List problem - Hlib - 09-15-2020, 03:57 PM
RE: Randomize a List problem - Albert Chan - 09-15-2020, 07:53 PM
RE: Randomize a List problem - Albert Chan - 09-17-2020, 12:11 PM
RE: Randomize a List problem - Hlib - 09-17-2020, 09:36 AM
RE: Randomize a List problem - John Keith - 09-17-2020, 12:20 PM
RE: Randomize a List problem - Albert Chan - 09-17-2020, 01:42 PM
RE: Randomize a List problem - John Keith - 09-17-2020, 08:21 PM
RE: Randomize a List problem - John Keith - 09-18-2020, 03:31 PM
RE: Randomize a List problem - Albert Chan - 09-18-2020, 10:19 PM
RE: Randomize a List problem - Albert Chan - 09-19-2020, 12:29 AM
RE: Randomize a List problem - pier4r - 10-13-2020, 07:13 PM
RE: Randomize a List problem - DavidM - 10-14-2020, 04:12 AM
RE: Randomize a List problem - Albert Chan - 10-15-2020, 04:43 PM
RE: Randomize a List problem - DavidM - 10-15-2020, 06:24 PM
RE: Randomize a List problem - pier4r - 10-14-2020, 06:55 PM
RE: Randomize a List problem - DavidM - 04-26-2024, 03:17 PM



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