View Single Post
Old 06-26-2018, 10:58 PM   #18
offsides
 
Join Date: Jun 2008
Location: Cheltenham, PA
Default Re: Update incoming: Please finish any Multiplayer games you have running

Quote:
Originally Posted by dwalend View Post
Oh, it'd be pretty obvious in the code if they did it intentionally.
Definitely, but I was thinking more along the lines of an unintentional skew. For example, some rand functions provide a floating-point number between 0 and 1. So to simulate a d6, you multiply by 6, add 1, and drop any fractions (truncate). If, say, you multiplied by 6 then rounded to the nearest whole number instead of adding 1 and truncating, you'd skew slightly towards the low end (50% greater chance for a 1, 50% lower chance for a 6). Not a huge difference, and once that should be easy to spot with a large enough sample size, but easy to miss with a small enough sample.

ETA: Or, if rand gives a random int (like C apparently does - it's been a while since I dealt with it apparently!) and you take (rand() % 6) to get a value between 0 and 5, unless (RAND_MAX-1) is divisible by 5, you're going to skew downwards a teeeeeeny bit because of the non-uniformity of possible values. And that one is going to take a much larger sample to spot because its so small.

Another possibility is that the random seeding is off, and that if seeded improperly it skews the results, but I don't know enough about that to say more than just pulling a guess out of thin air. But if it's easy enough to do, auditing the die rolls would make for both proof either way, not to mention some interesting data to graph :)
__________________
Joshua Megerman, SJGames MIB #5273 - Ogre AI Testing Division

Last edited by offsides; 06-26-2018 at 11:04 PM. Reason: Bad memory of rand
offsides is offline   Reply With Quote