RobinHankin / permutations

https://robinhankin.github.io/permutations/
5 stars 3 forks source link

riffle shuffle #29

Closed RobinHankin closed 2 years ago

RobinHankin commented 2 years ago

it would be good to implement riffle shuffles

RobinHankin commented 2 years ago
`faro` <- function(n,out=TRUE){
    jj <- t(matrix(seq_len(n*2),ncol=2))
    if(out){jj <- jj[2:1,]}
    as.word(c(jj))
}

sapply(2:10,function(n){permorder(faro(n,FALSE))}) # OEIS A002326