X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Frand%2FGaloisLFSR.hpp;h=f5de7ad0bb650f15d9d6870d82e3bd6f3ee97b70;hb=150d065f431d665326fd8028748c48a74ad956bb;hp=2ee476b6e321cc5d0298993b75e134b0727aeaad;hpb=825f479edf9867938b6789215ad7ae6303596cba;p=blank.git diff --git a/src/rand/GaloisLFSR.hpp b/src/rand/GaloisLFSR.hpp index 2ee476b..f5de7ad 100644 --- a/src/rand/GaloisLFSR.hpp +++ b/src/rand/GaloisLFSR.hpp @@ -48,6 +48,14 @@ public: return (*this)(next); } + float SNorm() noexcept { + return float(Next()) * (1.0f / 2147483647.5f) - 1.0f; + } + + float UNorm() noexcept { + return float(Next()) * (1.0f / 4294967295.0f); + } + template typename Container::reference From(Container &c) { return c[Next() % c.size()];