From bb83e2c9db0fc9746eb076a0ecbd5c64f899d7eb Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Tue, 8 Sep 2015 16:01:08 +0200 Subject: [PATCH] fix special case in rng --- src/rand/GaloisLFSR.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rand/GaloisLFSR.hpp b/src/rand/GaloisLFSR.hpp index 395ff8f..b071443 100644 --- a/src/rand/GaloisLFSR.hpp +++ b/src/rand/GaloisLFSR.hpp @@ -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 { -- 2.39.2