Friday, May 19, 2017

Enlighten Us GNDT Knower

Given in the GNDT
”  Comment:
(odd, odd, odd, odd, even?  DICE8589934592:1269931393   DICE8589934592:7369307947   DICE8589934592:5182583091   DICE8589934592:6682398381   DICE8589934592:5434761100 )” and a bunch of subsequent rolls which are all odd x 4 and even, something screwy seems to be up with the GNDT dice.

What did you find out pokes?

Comments

Sphinx:

05-19-2017 06:44:28 UTC

I found this (http://stackoverflow.com/a/35952792) stackoverflow thread related to perl’s random generator.

Apparently, when generating numbers with more than 32 bits, the lower bits are predictable.

So in case of pokes experiments, with 2^33, the parity of the numbers is predictable.

The value of the number apart from that isn’t, so I’m not sure how relevant it is. It’s basically just an issue if you roll huge dice, but the result depends on the least significant bits of the rolled nunber. And in that case why not roll a lower number in the first place?

A fix would be to limit dicerolls to 2^32, and do multiple if needed.

card:

05-19-2017 06:52:20 UTC

Well we won’t be rolling any dice like that soon, maybe someone could CfJ it.

pokes:

05-19-2017 09:58:43 UTC

Yes, it’s exactly as Sphinx said. I wanted to test out the good range of our DICE, and they do have the problem in that link where the first 32 bits are random but the last 16 are predictable.

Based on the source, Perl appears to seed the RNG with either /dev/urandom or a number of microseconds, and this happens between lines of the GNDT. So: a DICE(2^32) can be used to predict all future dice coming out of that line, and the least-significant values of DICE close to 2^32 or above are predictable. But that’s not very exploitable.

pokes:

05-19-2017 10:08:13 UTC

Just good to know for the future. Anyone writing a rule that calls for a (DICE2^34 mod 4) instead of a DICE4 deserves what they get.