http://qs321.pair.com?node_id=695754


in reply to Random Derangement Of An Array

All,
Here is an idea I came up with in #perl (freenode) thanks to a few folks there. Assume an even number of elements:

For instance: 0 - 9 might become 5, 3, 1, 2, 4, 7, 9, 8, 0, 6
Swap index 5 with 3, 1 with 2, 4 with 7, and 9 with 8

Cheers - L~R