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:
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. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)