]> git.localhorst.tv Git - blank.git/commitdiff
fix special case in rng
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 8 Sep 2015 14:01:08 +0000 (16:01 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 8 Sep 2015 14:01:08 +0000 (16:01 +0200)
src/rand/GaloisLFSR.hpp

index 395ff8f0546cc7b75cf111a4b996a7705052f29b..b0714432c77eb20e8cdeff74d6b2ce7dc7220f43 100644 (file)
@@ -12,7 +12,11 @@ class GaloisLFSR {
 public:
        // seed should be non-zero
        explicit GaloisLFSR(std::uint64_t seed) noexcept
-       : state(seed) { }
+       : state(seed) {
+               if (state == 0) {
+                       state = 1;
+               }
+       }
 
        // get the next bit
        bool operator ()() noexcept {