Skip to content

Commit

Permalink
[Refactoring] Replace std::random_shuffle with Shuffle
Browse files Browse the repository at this point in the history
std::random_shuffle is deprecated in C++14 and will be removed in C++17
  • Loading branch information
random-zebra committed Jul 30, 2021
1 parent e240c5f commit ad10b65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bench/bls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void BuildTestVectors(size_t count, size_t invalidCount,
for (size_t i = 0; i < invalidCount; i++) {
invalid[i] = true;
}
std::random_shuffle(invalid.begin(), invalid.end());
Shuffle(invalid.begin(), invalid.end(), FastRandomContext());

for (size_t i = 0; i < count; i++) {
secKeys[i].MakeNewKey();
Expand Down
3 changes: 2 additions & 1 deletion src/test/bls_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "test/test_pivx.h"
#include "bls/bls_worker.h"
#include "bls/bls_wrapper.h"
#include "random.h"

#include <boost/test/unit_test.hpp>

Expand Down Expand Up @@ -68,7 +69,7 @@ std::vector<size_t> GetRandomElements(size_t m, size_t n)
for (size_t i = 0; i < n; i++) {
idxs.emplace_back(i);
}
std::random_shuffle(idxs.begin(), idxs.end());
Shuffle(idxs.begin(), idxs.end(), FastRandomContext());
return std::vector<size_t>(idxs.begin(), idxs.begin() + m);
}

Expand Down

0 comments on commit ad10b65

Please sign in to comment.