X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmath%2FGaloisLFSR.hpp;h=f9a881c9db32aa2d40ebe9a79adce35c176ce41f;hb=a19fdf3d9f0d7ecbf6eeeec817856d85049a8336;hp=d380e248405a2efb1ae9b65308d3b05b48e09e18;hpb=27cbcf62c4608f9d3a408e903863f3f5e7e47ff0;p=blobs.git diff --git a/src/math/GaloisLFSR.hpp b/src/math/GaloisLFSR.hpp index d380e24..f9a881c 100644 --- a/src/math/GaloisLFSR.hpp +++ b/src/math/GaloisLFSR.hpp @@ -60,7 +60,11 @@ public: } double UNorm() noexcept { - return double(Next()) * (1.0 / 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