Rework of Random class. Now ensures better randomness, is more performant, and has function for retrieving seed.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-04-04 17:48:05 +02:00
parent 4f563e6e67
commit 6f60cd7c96
2 changed files with 45 additions and 38 deletions

View File

@@ -6,16 +6,16 @@
TEST_CASE("Random ints", "[Utilities]") {
auto rand = Arbutils::Random(10);
CHECK(rand.Get() == 1656398469);
CHECK(rand.Get() == 641584702);
CHECK(rand.Get() == 44564466);
CHECK(rand.Get() == 1062123783);
CHECK(rand.Get() == 1360749216);
CHECK(rand.Get() == 951367352);
CHECK(rand.Get() == 1608044094);
CHECK(rand.Get() == 1786516046);
CHECK(rand.Get() == 1070535660);
CHECK(rand.Get() == 1252673902);
CHECK(rand.Get() == -982170359);
CHECK(rand.Get() == 1283169405);
CHECK(rand.Get() == 89128932);
CHECK(rand.Get() == 2124247567);
CHECK(rand.Get() == -1573468864);
CHECK(rand.Get() == 1902734705);
CHECK(rand.Get() == -1078879109);
CHECK(rand.Get() == -721935204);
CHECK(rand.Get() == 2141071321);
CHECK(rand.Get() == -1789619491);
}
TEST_CASE("Random ints with limit", "[Utilities]") {
@@ -93,7 +93,7 @@ TEST_CASE("Random distribution (max 0, min 2)", "[Utilities]") {
TEST_CASE("Random distribution (max 0, min 3)", "[Utilities]") {
auto rand = Arbutils::Random(10);
const int size = 100000;
const int size = 500000;
int arr[size];
for (size_t i = 0; i < size; i++) {
arr[i] = rand.Get(0, 3);