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