in reply to Re^2: Array Shuffle
in thread Array Shuffle

Here's another mechanism for you:

  1. Make a copy of your array
  2. shuffle it (using List::Util::shuffle)
  3. do an element-wise comparison of your two arrays and if you find a match swap that element with an adjacent element
  4. goto 3 until you swap no more