Skip to content

Instantly share code, notes, and snippets.

@marked
Last active November 24, 2019 13:04
Show Gist options
  • Save marked/f49504b6acb807fe46ce6bb0f342ba79 to your computer and use it in GitHub Desktop.
Save marked/f49504b6acb807fe46ce6bb0f342ba79 to your computer and use it in GitHub Desktop.
0 0.24 0.00
1 0.37 0.24
2 0.80 0.61
3 1.38 1.41
4 2.16 2.79
5 3.47 4.96
6 5.47 8.43
7 9.73 13.90
8 12.78 23.63
9 23.84 36.41
10 42.44 60.24
11 70.04 102.68
12 89.49 172.72
13 139.85 262.21
14 185.64 402.06
15 234.70 587.69
16 630.16 822.39
17 1047.30 1452.55
18 1503.17 2499.85
19 2594.07 4003.02
20 2933.61 6597.09
0 0.38 0.00
1 0.50 0.38
2 0.92 0.88
3 1.45 1.79
4 3.47 3.24
5 6.83 6.71
6 10.82 13.55
7 23.79 24.36
8 32.55 48.16
9 76.30 80.70
10 139.19 157.01
11 149.74 296.20
12 310.13 445.93
13 565.06 756.07
14 1051.30 1321.13
15 2417.40 2372.43
16 3492.66 4789.83
17 5746.08 8282.49
18 11104.61 14028.58
19 15876.21 25133.19
20 40953.93 41009.40
0 0.35 0.00
1 0.57 0.35
2 1.08 0.91
3 1.78 1.99
4 4.51 3.77
5 4.99 8.28
6 10.63 13.27
7 27.33 23.90
8 47.82 51.23
9 75.54 99.05
10 177.57 174.59
11 243.36 352.16
12 703.32 595.52
13 1156.02 1298.84
14 2621.87 2454.85
15 4112.54 5076.72
16 11172.44 9189.26
17 20950.35 20361.70
18 32130.01 41312.04
19 56231.51 73442.05
20 82043.51 129673.56
import random
import sys
min_delay = .2
base = 1.8
def printf(format, *args):
sys.stdout.write(format % args)
def backoff_time(attempt):
"""Calculate backoff time from minimum delay and attempt number.
Currently no good reason for choice of backoff, except not to increase too rapidly."""
return min_delay*base**attempt+random.uniform(0, min_delay*base**attempt)
total = 0
for i in range(21):
bt = backoff_time(i)
printf("%3d\t%10.2f\t%10.2f\n", i, round(bt,2), round(total,2))
total += bt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment