Last active
December 19, 2015 08:38
-
-
Save arthur-flam/5926684 to your computer and use it in GitHub Desktop.
Random exponential sleep + warns it sleeps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' 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