← comparison · doc/strings.md

Strings

Strings are generated with the help of StringRandom class. As usual, you should interact with it via its global instance rnds.

Generators (rnds static methods)

std::string random(int len, const std::string& alphabet = "a-z")

std::string random(const std::string& pattern, ...)

std::string thueMorse(int len, char first = 'a', char second = 'b')

std::string abacaba(int len, char first = 'a')

std::pair<std::string, std::string> antiHash(
  const std::vector<std::pair<long long, long long>>& bases,
  const std::string& alphabet = "a-z",
  int length = -1)

int mod1 = rndm.randomPrime(1999000000, 2000000000);
int mod2 = rndm.randomPrime(1999000000, 2000000000);
int base1 = rnd.next(2000, 10000) * 2 + 1;
int base2 = rnd.next(2000, 10000) * 2 + 1;

auto res = rnds.antiHash( {{mod1, base1}, {mod2, base2}}, "a-z", -1);
cout << res.first << "\n" << res.second << "\n";

// or simply
cout << rnds.antiHash({{1000000007, 107}, {1000000009, 109}}) << "\n";