Post Reply 
Randomize a List problem
09-17-2020, 12:20 PM (This post was last modified: 09-17-2020 12:23 PM by John Keith.)
Post: #22
RE: Randomize a List problem
A few more random observations about the original (incorrect) RANL program:

The first iteration does nothing because the argument for ROLLD can never be greater than 1. The program would run faster starting 2 t FOR n...

The first element in the list can't move until the last iteration and has only 1 chance in n of ever doing so.

The indices of the permutations (see post #12) that the program can return are curious indeed:

Code:

{ 1 2 3 }
  1, 2, 3, 5

{ 1 2 3 4 }
  1, 2, 3, 4, 5, 6, 13, 14, 19, 20

{ 1 2 3 4 5 }
  1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 17, 19, 20, 21, 23, 49, 50, 51, 53, 73, 74, 77, 97, 98, 101

For a list of 6 elements, the first 24 permutations are returned, and the last 101 are not. The rest of the list is similarly chaotic.

Note that I have used lists of 1..n rather than n..1 as in HLIB's first post.
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)