From: fluffymormegil Date: Sun, 10 Oct 2010 20:42:11 +0000 (+0100) Subject: Adjusted S20prng.hh to work conveniently with dice X-Git-Tag: v1.0.0~22^2~27 X-Git-Url: http://git.blackswordsonics.com/?a=commitdiff_plain;h=72c8aa8c65d112177d88afe6173901aa6fce6f10;p=libmormegil Adjusted S20prng.hh to work conveniently with dice --- 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;