X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmath%2FGaloisLFSR.hpp;h=f9a881c9db32aa2d40ebe9a79adce35c176ce41f;hb=a19fdf3d9f0d7ecbf6eeeec817856d85049a8336;hp=4ce278f92b0fb56b0b34d3eaaf7d89975bbbe13c;hpb=cd9cee86b336b5ec531028ac2deebb391e48ed21;p=blobs.git diff --git a/src/math/GaloisLFSR.hpp b/src/math/GaloisLFSR.hpp index 4ce278f..f9a881c 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