-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.cpp
More file actions
55 lines (47 loc) · 1.13 KB
/
generator.cpp
File metadata and controls
55 lines (47 loc) · 1.13 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MEM_SIZE = 1024;
const int BLOCK_SIZE = 8;
// Generates a random number in the interval [l, r]
int random(int l, int r) {
return l + rng() % (r - l + 1);
}
void generate_add() {
int n = random(1, 100);
cout << n << endl;
for (int i = 0; i < n; i++) {
int fd = random(1, 255);
int size = random(1, MEM_SIZE / 2);
cout << fd << " " << size << endl;
}
}
void generate_get() {
cout << random(1, 255) << endl;
}
void generate_delete() {
cout << random(1, 255) << endl;
}
int main() {
int n = random(1, 1000);
cout << n << endl;
for (int i = 0; i < n; i++) {
int op = random(1, 4);
cout << op << endl;
switch (op) {
case 1:
generate_add();
break;
case 2:
generate_get();
break;
case 3:
generate_delete();
break;
case 4:
break;
}
}
return 0;
}