The use of 'POS' in the last challenge gave me an idea, just type in these two programs:
<< 1 10 FOR i RAND 4 RND i E6 * + NEXT 10 >LIST SORT << E4 * FP
100 * R>I >> MAP >>
and store in 'ARRY'
then << 1 10 FOR j DUP j POS SWAP NEXT DROP 10 >LIST R>I >> and
store in 'SHUFF'.
Then create a list with 'ARRY' to give a permutation of the first 10
(or however many you want) numbers. Then repeated use of 'SHUFF' returns a list of where the numbers were positioned in the first list, but then it toggles back to the original list, on and on, and it seems to work no matter how long the list. Can anyone offer the theory behind this? Thanks in advance. Glenn
Chewing gum for the 50g


« Next Oldest  Next Newest »
