Skip to content

Instantly share code, notes, and snippets.

@jeichorn
Created February 23, 2018 05:27
Show Gist options
  • Save jeichorn/ac1a06f6b5792c31324e84c97f367aff to your computer and use it in GitHub Desktop.
Save jeichorn/ac1a06f6b5792c31324e84c97f367aff to your computer and use it in GitHub Desktop.
<?php
function eb($retries)
{
return min(20000, (int) pow(2, $retries) * 100) + mt_rand(0, 100);
}
for($i = 0; $i < 10; $i++)
{
echo "Round $i\n";
for($r = 0; $r < 3; $r++)
{
echo " ".eb($r)."\n";
}
}
/*
Round 0
108
281
428
Round 1
110
204
495
Round 2
132
251
473
Round 3
197
228
479
Round 4
151
214
482
Round 5
145
205
427
Round 6
126
256
403
Round 7
131
212
403
Round 8
108
248
487
Round 9
144
226
458
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment