aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/getRandomASCIIString.cpp
blob: 594b4cd3228c607f0b7286b5657cdab7224620da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Common/getRandomASCIIString.h>
#include <Common/thread_local_rng.h>
#include <random>

namespace DB
{

String getRandomASCIIString(size_t length)
{
    std::uniform_int_distribution<int> distribution('a', 'z');
    String res;
    res.resize(length);
    for (auto & c : res)
        c = distribution(thread_local_rng);
    return res;
}

}