Skip to content

Instantly share code, notes, and snippets.

@arthur-flam
Last active December 19, 2015 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthur-flam/5926684 to your computer and use it in GitHub Desktop.
Save arthur-flam/5926684 to your computer and use it in GitHub Desktop.
Random exponential sleep + warns it sleeps
#' Random sleep
#'
#' Random exponential sleep + prints "sleeping".
#'
#' @param short Toogle shorter wait time
#' @references \url{https://twitter.com/ArthurFlam}
# @ArthurFlam
# random Sleep function
# Prints out
# mean time wait :
SLEEP = 5 #seconds
sleep=function(short=FALSE){
cat("...sleeping...")
if(short==FALSE) {Sys.sleep(rexp(1,1/SLEEP))} else Sys.sleep(rexp(1,10/SLEEP))
cat("\r \r")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment