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

Function random_array

test/speed_gsl.cpp:17–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

compare_1dFunction · 0.70
compare_2dFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected