mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
636 B
C++
34 lines
636 B
C++
6 years ago
|
#include <test_util.hpp>
|
||
|
|
||
|
#include <random>
|
||
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
namespace test
|
||
|
{
|
||
|
std::string
|
||
|
randFilename()
|
||
|
{
|
||
|
static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz";
|
||
|
|
||
|
std::random_device rd;
|
||
|
std::uniform_int_distribution< size_t > dist{0, sizeof(alphabet) - 2};
|
||
|
|
||
|
std::string filename;
|
||
|
for(size_t i = 0; i < 5; ++i)
|
||
|
{
|
||
|
filename.push_back(alphabet[dist(rd)]);
|
||
|
}
|
||
|
|
||
|
filename.push_back('.');
|
||
|
|
||
|
for(size_t i = 0; i < 5; ++i)
|
||
|
{
|
||
|
filename.push_back(alphabet[dist(rd)]);
|
||
|
}
|
||
|
|
||
|
return filename;
|
||
|
}
|
||
|
} // namespace test
|
||
|
} // namespace llarp
|