One thing you can consider is swapping elements at random. You could pick a random position in your collection, then swap the element in that position with the next element. This way, you can prevent swapping 1 with 3, or 2 with 4. You can do this repetitively, until the numbers are properly scrambled:
[1, 2, 3, 4]
random number is 0, swap with element at position 1.
[2, 1, 3, 4]
random number is 1, swap with element at position 2.
elements are 1 and 3, so don't swap.
[2, 1, 3, 4]
random number is 2, swap with element at position 3.
[2, 1, 4, 3]
etc.
If you'd like to generalize the constraint, you can simply change the condition. Instead of refusing to swap when the elements are either 1 and 3, or 2 and 4 (as in the example above), you could make sure the two elements at the positions to be swapped are not within 2 of each other, so something like if(b==a+2)continue;
:
elements are 5 and 7, so don't swap.
if(7==5+2)continue; // ie don't swap.