R/exponential_backoff.R

Defines functions exponential_backoff

exponential_backoff <- function(try, tries=10, first=1, last=10, integer=TRUE) {
  if (try > tries) {
    try <- tries
  }
  start <- log(first)
  end <- log(last)
  interval <- (end-start)/(tries-1)
  result <- exp(start + (try-1)*interval)
  if (integer) {
    return(round(result))
  } else {
    return(result)
  }
}

Try the sonicscrewdriver package in your browser

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

sonicscrewdriver documentation built on May 2, 2021, 5:06 p.m.