search for: separated__

Displaying 1 result from an estimated 1 matches for "separated__".

Did you mean: separated
2007 Apr 20
1
A particular shuffling on a vector
Hello, I was wondering if anyone can think of a straightforward way (without loops) to do the following shuffling: Let's imagine a vector: c(1,1,1,2,2,3,3,3) I would like to derive shuffled vectors __where the same digits are never separated__, although they can be at both ends (periodicity). So the following shuffled vectors are possible: c(2,2,1,1,1,3,3,3) c(2,1,1,1,3,3,3,2) c(3,3,3,1,1,1,2,2) c(3,1,1,1,2,2,3,3) etc ... I should mention that there can be any number of different numbers, and any number of repetition of each number....