X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmath%2FGaloisLFSR.hpp;h=e2f39ebb5110eb348ea26f57dcb377933a0ee5e6;hb=d364d8a9203138be1c569cdc31144f51883ec79f;hp=4ce278f92b0fb56b0b34d3eaaf7d89975bbbe13c;hpb=cd9cee86b336b5ec531028ac2deebb391e48ed21;p=blobs.git diff --git a/src/math/GaloisLFSR.hpp b/src/math/GaloisLFSR.hpp index 4ce278f..e2f39eb 100644 --- a/src/math/GaloisLFSR.hpp +++ b/src/math/GaloisLFSR.hpp @@ -60,7 +60,11 @@ public: } double UNorm() noexcept { - return double(Next()) / double(std::numeric_limits::max()); + return double(Next()) * (1.0 / double(std::numeric_limits::max())); + } + + unsigned int UInt(unsigned int below) noexcept { + return ((unsigned int)(UNorm() * double(below))) % below; } template