R/randomShuffle.R

Defines functions randomShuffle

Documented in randomShuffle

#' Function used to random shuffle some time series
#' @param x the time series you want to shuffle
#' @param n how many times you want to shuffle
#' @return a vector after random shuffle
#' @export

randomShuffle <- function(x,n){
  for (i in 1:n ) {
    x = x[.Internal(sample(length(x),length(x), FALSE, NULL))]
  }
  return(x)
}
zlfccnu/econophysics documentation built on Feb. 23, 2022, 10:22 p.m.