mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Use our PCG32 RNG instead of mt19937 in Benchmark::analyse_samples
This commit is contained in:
parent
1774dbfd53
commit
1887d42e3d
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_floating_point_helpers.hpp>
|
#include <catch2/internal/catch_floating_point_helpers.hpp>
|
||||||
|
#include <catch2/internal/catch_random_number_generator.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -368,7 +369,7 @@ namespace Catch {
|
|||||||
auto Estimate = [=](double(*f)(double const*, double const*)) {
|
auto Estimate = [=](double(*f)(double const*, double const*)) {
|
||||||
auto seed = entropy();
|
auto seed = entropy();
|
||||||
return std::async(std::launch::async, [=] {
|
return std::async(std::launch::async, [=] {
|
||||||
std::mt19937 rng(seed);
|
SimplePcg32 rng( seed );
|
||||||
auto resampled = resample(rng, n_resamples, first, last, f);
|
auto resampled = resample(rng, n_resamples, first, last, f);
|
||||||
return bootstrap(confidence_level, first, last, resampled, f);
|
return bootstrap(confidence_level, first, last, resampled, f);
|
||||||
});
|
});
|
||||||
@ -382,7 +383,7 @@ namespace Catch {
|
|||||||
#else
|
#else
|
||||||
auto Estimate = [=](double(*f)(double const* , double const*)) {
|
auto Estimate = [=](double(*f)(double const* , double const*)) {
|
||||||
auto seed = entropy();
|
auto seed = entropy();
|
||||||
std::mt19937 rng(seed);
|
SimplePcg32 rng( seed );
|
||||||
auto resampled = resample(rng, n_resamples, first, last, f);
|
auto resampled = resample(rng, n_resamples, first, last, f);
|
||||||
return bootstrap(confidence_level, first, last, resampled, f);
|
return bootstrap(confidence_level, first, last, resampled, f);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user