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 E-6 * + 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 »
|
▼
Post: #2
07-18-2010, 01:26 PM
▼ ▼
Post: #4
07-20-2010, 09:33 AM
Thanks for your swift and sure response. I didn't know what I had stepped into, but it's amazing what a great resource these forum members can be (plus Wikipedia) - who needs school! I also noted which lists are invariant, like numbers in their "proper" positions |