blob: 9ea8f2676fd7c8d2598ecdf7801c53b39b12e5ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <chrono>
#include <thread>
#include <random>
#include "lib.h"
// yeah this is bad, boo hoo
using namespace std;
using std::this_thread::sleep_for;
using std::chrono::milliseconds;
random_device dev;
mt19937 rng(dev());
uniform_int_distribution<mt19937::result_type> random_dist(1, 50);
static void random_slow() {
int delay = random_dist(rng);
sleep_for(milliseconds(delay));
}
int recursive(int rem) {
if (rem <= 0) return 0;
random_slow();
return recursive(rem - 1) + recursive(rem - 2);
}
|