Randomize a List problem
|
09-14-2020, 11:41 PM
(This post was last modified: 09-15-2020 08:49 AM by Albert Chan.)
Post: #5
|
|||
|
|||
RE: Randomize a List problem
Confession time. I have never program in HP-50g.
This is my first program, after skimming the online manual To move random element out of the way, I do it in 2 steps. ROLL it to top-of-stack, then ROLLD it to bottom-of-stack. ≪ { 3. 2. 1 } LIST➝ ➝ t ≪ t 2. FOR n n RAND × CEIL ROLL t ROLLD -1 STEP t ➝LIST ≫ ≫ We can also replace "t ROLLD" to "n ROLLD", possibly run faster ? P.S. possibly non-issue. "n RAND × CEIL" might return an index of 0 But, on the emulator 0 ROLL ≡ 1 ROLL ≡ do nothing. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)