diff options
| author | Bryan Galdrikian <[email protected]> | 2019-05-03 00:25:46 -0700 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2019-05-03 00:25:46 -0700 |
| commit | 74b64a27f8e07b1b0b47b809b1a060518fa11a97 (patch) | |
| tree | 34cca01711be56892c149706f02ba7358d87ec54 /test/src/unit | |
| parent | Fixing chunk reorder bug in BlastTool, when importing a prefractured mesh (diff) | |
| download | blast-1.1.5_pre1.tar.xz blast-1.1.5_pre1.zip | |
Blast SDK 1.1.5 prerelease #1v1.1.5_pre1
Diffstat (limited to 'test/src/unit')
| -rwxr-xr-x | test/src/unit/ActorTests.cpp | 6 | ||||
| -rwxr-xr-x | test/src/unit/AssetTests.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/test/src/unit/ActorTests.cpp b/test/src/unit/ActorTests.cpp index f25f6e4..7756e76 100755 --- a/test/src/unit/ActorTests.cpp +++ b/test/src/unit/ActorTests.cpp @@ -30,6 +30,7 @@ #include "AssetGenerator.h"
#include <map>
+#include <random>
#include <algorithm>
#include "NvBlastActor.h"
@@ -650,7 +651,10 @@ public: {
order[i] = i;
}
- std::random_shuffle(order.begin(), order.end());
+
+ std::random_device rd;
+ std::mt19937 g(rd());
+ std::shuffle(order.begin(), order.end(), g);
for (size_t i = 0; i < actors.size(); ++i)
{
diff --git a/test/src/unit/AssetTests.cpp b/test/src/unit/AssetTests.cpp index 6511f60..58ea7d1 100755 --- a/test/src/unit/AssetTests.cpp +++ b/test/src/unit/AssetTests.cpp @@ -33,6 +33,7 @@ #include "NvBlastTkFramework.h"
+#include <random>
#include <algorithm>
@@ -301,13 +302,16 @@ public: // An array into which to copy the reordered descs
std::vector<NvBlastChunkDesc> shuffledChunkDescs(chunkDescCount);
+ std::random_device rd;
+ std::mt19937 g(rd());
+
std::vector<char> scratch;
const uint32_t trials = 30;
uint32_t attempt = 0;
while(1)
{
// Shuffle the reorder array
- std::random_shuffle(shuffledOrder.begin(), shuffledOrder.end());
+ std::shuffle(shuffledOrder.begin(), shuffledOrder.end(), g);
// Save initial bonds
std::vector<NvBlastBondDesc> savedBondDescs(bondDescs, bondDescs + bondDescCount);
|