X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=blobdiff_plain;f=src%2Fmath%2FGaloisLFSR.hpp;h=e2f39ebb5110eb348ea26f57dcb377933a0ee5e6;hp=d380e248405a2efb1ae9b65308d3b05b48e09e18;hb=d364d8a9203138be1c569cdc31144f51883ec79f;hpb=a5f1670b11c4c0ab0006ebbb04b0a6a0f32f0a7c diff --git a/src/math/GaloisLFSR.hpp b/src/math/GaloisLFSR.hpp index d380e24..e2f39eb 100644 --- a/src/math/GaloisLFSR.hpp +++ b/src/math/GaloisLFSR.hpp @@ -63,6 +63,10 @@ public: 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 typename Container::reference From(Container &c) { assert(c.size() > 0);