generateMetalogFile.cpp 1010 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <fstream>
  2. #include <string>
  3. #include <iostream>
  4. #include <random>
  5. int main18236() {
  6. std::cout << "Hello World";
  7. std::fstream writer("generated.metalog", std::ios::out);
  8. const int numberOfParts = 5;
  9. const int amountOfBits = 100;
  10. const int pointsPerPart = 20;
  11. //random
  12. std::random_device rd; //Will be used to obtain a seed for the random number engine
  13. std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd()
  14. std::uniform_real_distribution<double> doubleDistr(0.0, 1.0);
  15. for (int i = 0; i < numberOfParts; i++) {
  16. for (int pN = 0; pN < pointsPerPart; pN++) {
  17. writer << "of:" << std::to_string(10.0 * (i + 1)) << " i:" << i << " pN:" << pN << " b:";
  18. int part = amountOfBits / numberOfParts;
  19. for (int index = 0; index < amountOfBits; index++) {
  20. if (i * part < index && index <= (i+1)*part) {
  21. writer << (doubleDistr(gen) < 0.95 ?"1":"0");
  22. }
  23. else {
  24. writer << "0";
  25. }
  26. }
  27. writer << std::endl;
  28. }
  29. }
  30. writer.close();
  31. return 0;
  32. }