MCPcopy Create free account
hub / github.com/comaps/comaps / GetNormalValues

Function GetNormalValues

libs/coding/coding_tests/succinct_ef_test.cpp:30–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29template <class T>
30vector<T> GetNormalValues(size_t count, T mean)
31{
32 normal_distribution<> randDist(mean, 2);
33 random_device randDevice;
34 mt19937 randEngine(randDevice());
35
36 vector<T> data(count);
37 for (size_t i = 0; i < count; ++i)
38 {
39 // Use max - 1 because succinct makes val + 1 encoding internals.
40 T constexpr const kMax = numeric_limits<T>::max() - 1;
41 double d = round(randDist(randEngine));
42 if (d < 0)
43 d = 0;
44 else if (d > kMax)
45 d = kMax;
46 data[i] = static_cast<T>(d);
47 }
48 return data;
49}
50
51template <class T>
52double GetCompressionRatio(vector<T> const & data)

Callers 1

UNIT_TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected