MCPcopy Create free account
hub / github.com/boostorg/histogram / random_array

Function random_array

test/speed_root.cpp:19–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include <random>
18
19std::unique_ptr<double[]> random_array(unsigned n, int type) {
20 std::unique_ptr<double[]> r(new double[n]);
21 std::default_random_engine gen(1);
22 if (type) { // type == 1
23 std::normal_distribution<> d(0.5, 0.3);
24 for (unsigned i = 0; i < n; ++i) r[i] = d(gen);
25 } else { // type == 0
26 std::uniform_real_distribution<> d(0.0, 1.0);
27 for (unsigned i = 0; i < n; ++i) r[i] = d(gen);
28 }
29 return r;
30}
31
32void compare_1d(unsigned n, int distrib) {
33 auto r = random_array(n, distrib);

Callers 4

compare_1dFunction · 0.70
compare_2dFunction · 0.70
compare_3dFunction · 0.70
compare_6dFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected