R/fyshuffle.R

fyshuffle <-
function(x){
  n <- length(x)
  i <- n 
  while (i>0){
    j <- floor(runif(1) * i+1)
    if (i != j){
      temp <- x[i]
      x[i] <- x[j]
      x[j] <- temp
    }
    i <- i - 1
  }
  return(x)
}

Try the fgpt package in your browser

Any scripts or data that you put into this service are public.

fgpt documentation built on May 1, 2019, 9:45 p.m.