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

Function random_array

test/speed_cpp.cpp:20–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18using boost::mp11::mp_list;
19
20std::unique_ptr<double[]> random_array(unsigned n, int type) {
21 std::unique_ptr<double[]> r(new double[n]);
22 std::default_random_engine gen(1);
23 if (type) { // type == 1
24 std::normal_distribution<> d(0.5, 0.3);
25 for (unsigned i = 0; i < n; ++i) r[i] = d(gen);
26 } else { // type == 0
27 std::uniform_real_distribution<> d(0.0, 1.0);
28 for (unsigned i = 0; i < n; ++i) r[i] = d(gen);
29 }
30 return r;
31}
32
33template <class T>
34void ignore(const T&) {}

Callers 5

baselineFunction · 0.70
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