20 std::random_device rd;
21 std::mt19937 gen(rd());
22 std::uniform_real_distribution<> dis(
a,
b);
23 std::for_each(x.begin(), x.end(), [&](
double &v) { v = dis(gen); });
28 std::random_device rd;
29 std::mt19937 gen(rd());
30 std::uniform_real_distribution<> dis(0, 1);
31 for (
size_t i = 0; i < x.size(); i += 9)
34 double e1 = 2 * M_PI * dis(gen);
35 double e2 = 2 * M_PI * dis(gen);
36 double e3 = 2 * M_PI * dis(gen);
37 const double c1 = cos(e1);
38 const double s1 = sin(e1);
39 const double c2 = cos(e2);
40 const double s2 = sin(e2);
41 const double c3 = cos(e3);
42 const double s3 = sin(e3);
46 x[i + 0] = c1 * c3 - c2 * s1 * s3;
47 x[i + 1] = -c1 * s3 - c2 * c3 * s1;
49 x[i + 3] = c3 * s1 + c1 * c2 * s3;
50 x[i + 4] = c1 * c2 * c3 - s1 * s3;
void FillWithRandomRotations(std::vector< double > &x)
void FillWithRandomNumbers(std::vector< double > &x, double a, double b)
Fills the vector x with random numbers between a and b.