Randomly shuffle runs of 0s & 1s in a vector but maintain their alternating order, i.e. there'll never be joint runs of 0s or 1s from the original sequence. We assume that the vector consists of 0s & 1s.

shuffBlockVecAlt(x)

Arguments

x

a numeric vector

Value

a numeric vector

Examples

library(ARCOS)
set.seed(7)
x <- round(runif(20))
ARCOS:::shuffBlockVecAlt(x)
#>  [1] 1 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0