Skip to content

Commit b7a4b57

Browse files
SirJosh3917SirJosh3917
authored andcommitted
fix c++17 deprectaion of random_shuffle & update ci/cd to fail on windows when build fails
1 parent d923542 commit b7a4b57

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/nightly_build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ jobs:
7575

7676
- name: Build SFML
7777
if: steps.cache-sfml.outputs.cache-hit != 'true'
78+
shell: bash
7879
run: |
80+
set -e
7981
git clone https://github.com/SFML/SFML --depth 1
8082
pushd SFML
8183
cmake -B build -DSFML_USE_STATIC_STD_LIBS=TRUE -DBUILD_SHARED_LIBS=FALSE
@@ -88,7 +90,9 @@ jobs:
8890
uses: actions/[email protected]
8991

9092
- name: Build Project
93+
shell: bash
9194
run: |
95+
set -e
9296
cmake -B build
9397
cmake --build build --config Release
9498
cmake --install build --config Release

src/SortingVisualizer/Collection.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
#include <SortingVisualizer/Collection.hpp>
33
#include <algorithm>
4+
#include <random>
45
#include <stdint.h>
56
#include <vector>
67

@@ -43,7 +44,7 @@ const uint64_t Collection::max() const { return *std::max_element(this->values.b
4344

4445
std::vector<uint64_t> Collection::contents() const { return this->values; }
4546

46-
void Collection::randomize() { std::random_shuffle(this->values.begin(), this->values.end()); }
47+
void Collection::randomize() { std::shuffle(this->values.begin(), this->values.end(), std::mt19937(std::random_device()())); }
4748

4849
const std::vector<Decision> &Collection::getDecisions() const { return this->decisions; }
4950

0 commit comments

Comments
 (0)