Skip to content

Instantly share code, notes, and snippets.

@phund
Created September 11, 2019 09:15
Show Gist options
  • Save phund/bd85b67251607688208c94af91c03e40 to your computer and use it in GitHub Desktop.
Save phund/bd85b67251607688208c94af91c03e40 to your computer and use it in GitHub Desktop.
def cal_retry_time(retry_count)
time = 0
(1..retry_count).each do |rc|
time += ((rc ** 4) + 15 + (rand(30) * (rc + 1)))
end
p "time: #{time}s => #{time.to_f/3600}h => #{time.to_f/3600/24}day(s)"
end
cal_retry_time(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment