From 48301abe6b07ef4da89fad940b151f929ff91666 Mon Sep 17 00:00:00 2001 From: Avril Date: Wed, 25 Nov 2020 19:13:25 +0000 Subject: [PATCH] fx --- lean/src/rng.cpp | 4 ++-- lean/src/rng/frng.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lean/src/rng.cpp b/lean/src/rng.cpp index ce3c1ce..336618a 100644 --- a/lean/src/rng.cpp +++ b/lean/src/rng.cpp @@ -33,7 +33,7 @@ std::int32_t RNG::next_int(std::int32_t min, std::int32_t max) std::int32_t RNG::next_int() { - return next_int(INT32_MIN, INT32_MAX); + return (chance() ? 1 : -1) * (std::int32_t)floor(sample() * (double)INT32_MAX); } std::int64_t RNG::next_long(std::int64_t min, std::int64_t max) @@ -43,5 +43,5 @@ std::int64_t RNG::next_long(std::int64_t min, std::int64_t max) std::int64_t RNG::next_long() { - return next_long(INT64_MIN, INT32_MAX); + return (chance() ? 1l : -1l) * (std::int64_t)floor(sample() * (double)INT64_MAX); } diff --git a/lean/src/rng/frng.cpp b/lean/src/rng/frng.cpp index acf62ac..c9b85fe 100644 --- a/lean/src/rng/frng.cpp +++ b/lean/src/rng/frng.cpp @@ -10,7 +10,7 @@ namespace rng { for(int i=0;i<10;i++) { double d = rng.next_double(); - long l = rng.next_long(0, 100); + long l = rng.next_long(-10, 10); std::array ar; for(auto& i : ar) i = rng.chance();