Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <ctime>
- #include <fstream>
- #include <string>
- #include <vector>
- int main(int argc, char *argv[]) {
- const std::string smallalphabet = "ab";
- const std::string largealphabet = "qwer";
- srand(time(nullptr));
- const int SMALL_FILE_SIZE = 10000;
- const int LARGE_FILE_SIZE = 100000;
- std::ofstream smallfile("smallfile.txt");
- std::ofstream largefile("largefile.txt");
- std::ofstream patterns("patterns.txt");
- std::string smallstring;
- std::string largestring;
- for (int i = 0; i < SMALL_FILE_SIZE; ++i) {
- smallstring += smallalphabet[rand() % 2];
- }
- for (int i = 0; i < LARGE_FILE_SIZE; ++i) {
- largestring += largealphabet[rand() % 4];
- }
- smallfile << smallstring << std::endl;
- largefile << largestring << std::endl;
- for (int sz = 100; sz <= 3000; sz += 100) {
- int small_i = rand() % (SMALL_FILE_SIZE - sz);
- int large_i = rand() % (LARGE_FILE_SIZE - sz);
- patterns << smallstring.substr(small_i, sz) << "," <<
- largestring.substr(large_i, sz) << std::endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement