Skip to content

Commit

Permalink
Use C++ random (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau authored Sep 25, 2024
1 parent 4749ad1 commit 148a84f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bugprone-*,
-bugprone-integer-division,
-bugprone-narrowing-conversions,
-bugprone-unchecked-optional-access,
cert-msc50-cpp,
google-readability-avoid-underscore-in-googletest-name,
hicpp-avoid-c-arrays,
misc-*,
Expand Down
2 changes: 1 addition & 1 deletion tests/splines/batched_2d_spline_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ static void Batched2dSplineTest()
dx<I2>(ncells),
s_degree,
s_degree),
1e-12 * max_norm_diff12));
1e-11 * max_norm_diff12));
}

#if defined(BC_PERIODIC) && defined(BSPLINES_TYPE_UNIFORM)
Expand Down
7 changes: 5 additions & 2 deletions tests/splines/polynomial_evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <array>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <random>

#include <ddc/ddc.hpp>
#include <ddc/kernels/splines.hpp>
Expand All @@ -29,8 +29,11 @@ struct PolynomialEvaluator
template <class Domain>
Evaluator(Domain domain) : m_xN(std::max(std::abs(rmin(domain)), std::abs(rmax(domain))))
{
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution dis(0., 1.);
for (int i(0); i < Degree + 1; ++i) {
m_coeffs[i] = double(rand() % 100) / 100.0;
m_coeffs[i] = dis(gen);
}
}

Expand Down

0 comments on commit 148a84f

Please sign in to comment.