Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Dice roller is seeming to skew low

I've been playing with Roll20 for a little while now, and I'm finding the /roll1d20 command seems to be somewhat less than random. I mentioned this to the group I've been playing with and they all agreed that it seems to be rolling low. One of our guys decided to break down the numbers and see: "So, I went through our chat logs and looked up dice rolls. Total Rolls = 456 Sum of all rolls = 4588 Average of Rolls = 10.0614 (expected average 10.5) Distribution of rolls Result Count 1 25 2 29 3 23 4 25 5 28 6 23 7 24 8 23 9 18 10 13 11 31 12 22 13 25 14 28 15 19 16 17 17 19 18 21 19 26 20 17 The distribution is interesting; on average, each value should be represented 22.8 times. Here's what it looks like: Based on that, I'd say, yeah...the die roller is likely badly biased." Now I'll admit that 450+ rolls are still on the low end of a good sample size, but it's enough to show trends, and from our data at least, it's looking like it's coming up on the low end of things.
So, this actually really piqued my interest; I decided to investigate further to see what I could find. I used a demo campaign to roll 999d20 ten times, for a total of 9990 rolls (999 is the max you can roll at once). I grabbed the strings, plugged them into a Python interpreter, then split the string into individual numbers. Here's the results from the numbers that I had (if someone wants to confirm I did the math right, feel free :) I'd appreciate the double-check): Number of rolls: 9990 Avg roll: 10.5092 As far as I can tell, your group just got unlucky with your rolls :( Roll / Number times rolled 1 516 2 505 3 507 4 478 5 482 6 506 7 513 8 473 9 503 10 505 11 519 12 501 13 489 14 483 15 466 16 525 17 485 18 493 19 539 20 502
Ok, thanks for looking into it. I'll keep an eye on it from my end too. Maybe it's bad luck, maybe something's up, More data never hurts.
Oh most definitely, more data never hurts. I'd be curious if you could grab a similar set of numbers from your side, so we could compare.
Is there a quick way to pull standard deviation from here? I'd be interested in seeing that. (Quick research shows expected st dev is 5.77)
It occurs to me that the easy way to determine how random it is would be to just ask the devs what RNG they're using. Unless they wrote their own, of course. So, Riley et al , what random number generator are you using for Roll20?
Does Roll20 use a Random Seed like the internal clock or something more sophisticated?
Right now we're just using the browser's built-in random number generator. Which is seeded based on the time. But after reading this: <a href="http://baagoe.org/en/w/index.php/Better_random_numbers_for_javascript" rel="nofollow">http://baagoe.org/en/w/index.php/Better_random_numbers_for_javascript</a> I'm starting to think maybe we should use one of those suggested methods instead. I think that the built-in generator is "good enough", but I'm wondering if what's maybe going on is that it doesn't have a great distribution for small sample sizes (which would seem to make games "skew low" or "high" often, but show a good distribution over thousands of rolls like Balladeer's test). Also apparently each browser vendor is on their own in terms of their implementation of the details, so who knows, there could even be differences among browsers in terms of how "good" the generator is. So I think I'll implement something better here shortly.
Yeah, one of the things I discovered when I wrote the dice roller for Google Wave was that Step 1 was to find something better than the built-in Java random number generator. Step 2 was to re-seed frequently, if possible.
Is there a quick way to pull standard deviation from here? I'd be interested in seeing that. (Quick research shows expected st dev is 5.77) Well, it looks like Riley's got things under control, but to answer your question, the standard deviation for my data set was 5.79.