-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString.cpp
More file actions
48 lines (45 loc) · 1.04 KB
/
Copy pathString.cpp
File metadata and controls
48 lines (45 loc) · 1.04 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
# include "String.h"
// A constructor
Rstring :: Rstring()
{
N = 0;
generator.seed(system_clock :: now().time_since_epoch().count());
}
// A function that generates a random string
void Rstring :: generate(int n, Timer &t1)
{
vector <int> chars;
Distribution :: FillArray(chars, n, 97, 122, false, t1);
for(int i = 0; i < n; i++)
{;
fout << (char)chars[i];
t1.time(1);
}
fout << '\n';
}
// A function generates string test case files
void Rstring :: setCase(string &s, int T, int t, int n, int v, int sz, string &folder_name)
{
int pt = FileOp :: printT(t);
cout << "Generating string test files: " << '\n';
for(int i = 0; i < T; i++)
{
FileOp :: setFile(folder_name, s, i, fout);
vector <int> times = numOp :: giveRints(t, n, sz);
N = times.size();
if(pt)
fout << N << '\n';
int tcnt = 0;
for(int j = 0; j < N; j++)
tcnt += times[j];
Timer t1(2 * tcnt);
for(int j = 0; j < N; j++)
{
if(v)
fout << times[j] << '\n';
generate(times[j], t1);
}
fout.close();
}
cout << "string generation completed." << '\n';
}