Skip to content

Commit ed33e92

Browse files
authored
Fix inconsistent use of normal_distribution in benchmarks and tests (#5404)
1 parent c0f5f35 commit ed33e92

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

benchmarks/src/adjacent_difference.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void bm(benchmark::State& state) {
2323
vector<T> output(size);
2424

2525
if constexpr (is_floating_point_v<T>) {
26-
normal_distribution<T> dis(-100.0, 100.0);
26+
normal_distribution<T> dis(0, 100000.0);
2727
ranges::generate(input, [&] { return dis(gen); });
2828
} else {
2929
static_assert(is_unsigned_v<T>, "This avoids signed integers to avoid UB; they shouldn't perform differently");

benchmarks/src/minmax_element.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void bm(benchmark::State& state) {
2828
mt19937 gen(84710);
2929

3030
if constexpr (is_floating_point_v<T>) {
31-
normal_distribution<T> dis(0, 10000.0);
31+
normal_distribution<T> dis(0, 100000.0);
3232
ranges::generate(a, [&] { return dis(gen); });
3333
} else {
3434
uniform_int_distribution<conditional_t<sizeof(T) != 1, T, int>> dis(1, 20);

tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void test_min_max_element_floating_with_values(mt19937_64& gen, const vector<T>&
2626

2727
template <class T>
2828
void test_min_max_element_floating_any(mt19937_64& gen) {
29-
normal_distribution<T> dis(-100000.0, 100000.0);
29+
normal_distribution<T> dis(0, 100000.0);
3030

3131
constexpr auto input_of_input_size = dataCount / 2;
3232
vector<T> input_of_input(input_of_input_size);

0 commit comments

Comments
 (0)