Skip to content

Commit

Permalink
Do not use a set seed in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
r-devulap committed Oct 12, 2023
1 parent 01f0f02 commit cbd6179
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test-qsort-common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef AVX512_TEST_COMMON
#define AVX512_TEST_COMMON

#define XSS_DO_NOT_SET_SEED

#include "custom-compare.h"
#include "rand_array.h"
#include "x86simdsort.h"
Expand Down
4 changes: 4 additions & 0 deletions utils/rand_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ static std::vector<T> get_uniform_rand_array(
std::random_device rd;
if constexpr(std::is_floating_point_v<T>) {
std::mt19937 gen(rd());
#ifndef XSS_DO_NOT_SET_SEED
gen.seed(42);
#endif
std::uniform_real_distribution<T> dis(min, max);
for (int64_t ii = 0; ii < arrsize; ++ii) {
arr.emplace_back(dis(gen));
Expand All @@ -39,7 +41,9 @@ static std::vector<T> get_uniform_rand_array(
#endif
else if constexpr(std::is_integral_v<T>) {
std::default_random_engine e1(rd());
#ifndef XSS_DO_NOT_SET_SEED
e1.seed(42);
#endif
std::uniform_int_distribution<T> uniform_dist(min, max);
for (int64_t ii = 0; ii < arrsize; ++ii) {
arr.emplace_back(uniform_dist(e1));
Expand Down

0 comments on commit cbd6179

Please sign in to comment.