MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / getRandomString

Function getRandomString

test/test_manacher_odd.cpp:6–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "manacher_odd.h"
5
6string getRandomString(size_t n, uint32_t seed, char minLetter='a', char maxLetter='b') {
7 assert(minLetter <= maxLetter);
8 const size_t nLetters = static_cast<int>(maxLetter) - static_cast<int>(minLetter) + 1;
9 std::uniform_int_distribution<size_t> distr(0, nLetters - 1);
10 std::mt19937 gen(seed);
11
12 string res;
13 res.reserve(n);
14
15 for (size_t i = 0; i < n; ++i)
16 res.push_back('a' + distr(gen));
17
18 return res;
19}
20
21bool testManacherOdd(const std::string &s) {
22 const auto n = s.size();

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected