Displaying 1 result from an estimated 1 matches for "newemm".
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)