Randomize a List problem
|
09-15-2020, 03:57 PM
(This post was last modified: 09-15-2020 04:01 PM by Hlib.)
Post: #11
|
|||
|
|||
RE: Randomize a List problem
Thanks everyone!
In our examples, can we estimate the number of different combinations for lists of any size? There may be unexpected results. I inserted a fragment into the source program, which swaps 1-st and random n-th elements on stack: Code: << { } LIST➝ ➝ t #2 {2 1} – 2 options out of 2!=2 possible. #3 {3 2 1} – 6 options out of 3!=6 possible. #4 {4 3 2 1} – 24 / out of 4!=24. #5 {5 4 3 2 1} – 107=5!–13 / out of 5!=120. #6 {6 5 4 3 2 1} – 685=6!–35 / out of 6!=720. For many practical problems we don`t need to have equal probabilities for each permutation, and we don`t always need the maximum number of possible combinations. But in these short programs before using them I would like to estimate at least the range of results that we get using the stack process. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)