Randomize a List problem
|
09-17-2020, 01:42 PM
Post: #23
|
|||
|
|||
RE: Randomize a List problem
(09-17-2020 12:20 PM)John Keith Wrote: A few more random observations about the original (incorrect) RANL program: Your optimization works, as long as the list has more than 1 item. With a starting of 2, this meant it is possible to hit with 2 ROLLD, even if t=1 For most other programming languages, this is not a problem. However, HP-50g has a FOR loop quirk, that *always* run the loop at least once. ≪ 2. 1. FOR n n NEXT ≫ EVAL → 2. To see the actual problem, lets save RANL "optimization" under 'RANL2' ≪ LIST➝ ➝ t ≪ 2. t FOR n n RAND × CEIL ROLLD NEXT t ➝LIST ≫ ≫ Starting with an empty stack: {10.} RANL2 → "ROLLD Error: Too few Arguments", now stack = 10, 2 {20.} RANL2 → 10., 2., {20.} ok RANL2 → 10. 20., {2.} ??? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)