]> git.localhorst.tv Git - blobs.git/blobdiff - src/math/GaloisLFSR.hpp
color mutation
[blobs.git] / src / math / GaloisLFSR.hpp
index 4ce278f92b0fb56b0b34d3eaaf7d89975bbbe13c..e2f39ebb5110eb348ea26f57dcb377933a0ee5e6 100644 (file)
@@ -60,7 +60,11 @@ public:
        }
 
        double UNorm() noexcept {
-               return double(Next<std::uint64_t>()) / double(std::numeric_limits<std::uint64_t>::max());
+               return double(Next<std::uint64_t>()) * (1.0 / double(std::numeric_limits<std::uint64_t>::max()));
+       }
+
+       unsigned int UInt(unsigned int below) noexcept {
+               return ((unsigned int)(UNorm() * double(below))) % below;
        }
 
        template<class Container>