mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-20 11:59:12 -05:00
21 lines
669 B
C++
21 lines
669 B
C++
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md
|
|
|
|
#include <algorithm>
|
|
#include "RandomStringGenerator.hpp"
|
|
|
|
std::string RandomStringGenerator::getRandomString()
|
|
{
|
|
const size_t length = lengthDist(rng);
|
|
std::string str(length, 0);
|
|
std::generate_n(str.begin(), length, [this]() { return charSet[charDist(rng)]; });
|
|
return str;
|
|
}
|
|
|
|
std::vector<std::string> RandomStringGenerator::createRandomStringVector(size_t size)
|
|
{
|
|
std::vector<std::string> vec(size);
|
|
std::generate_n(vec.begin(), size, [this]() { return getRandomString(); });
|
|
return vec;
|
|
}
|