From 72c8aa8c65d112177d88afe6173901aa6fce6f10 Mon Sep 17 00:00:00 2001 From: fluffymormegil Date: Sun, 10 Oct 2010 21:42:11 +0100 Subject: [PATCH] Adjusted S20prng.hh to work conveniently with dice --- include/libmormegil/S20prng.hh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/libmormegil/S20prng.hh b/include/libmormegil/S20prng.hh index de5a64b..14f8901 100644 --- a/include/libmormegil/S20prng.hh +++ b/include/libmormegil/S20prng.hh @@ -93,10 +93,8 @@ namespace libmormegil doubleround(); } } - uint32_t generate() + void runstate() { - if (!subcounter) - { state[0] = Fixed1; state[1] = key[0]; state[2] = key[1]; @@ -113,8 +111,14 @@ namespace libmormegil state[13] = key[6]; state[14] = key[7]; state[15] = Fixed4; - ++counter; slash(12); + } + uint32_t generate() + { + if (!subcounter) + { + runstate(); + ++counter; } ++subcounter; subcounter &= 15; -- 2.11.0