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

Randomness of Rollable Tables

1457035660

Edited 1457035737
Hi, i have attempted to bring up this matter several times but seem to fail at communicating it effectively.   I recently made a rollable table with 325+ entries occurring in alphabetical order.  However, every time -& i am talking many dozens of rolls, i tested it, it would stay within a very close range of the alphabetical listing the initial roll landed in, maybe only deviating by one alphabetical letter in either direction.  For example, as if instead of falling randomly in the full range between Armadillo or Zebra, every roll stayed right in the range of Mongoose, Lizard, Lion, Newt etc -a very narrow cross section.  Like i said, this was after many many rolls that the pattern continued. So my questions are: #1, does the number of entries in a rollable table cause it's random pattern to change?  For example, will a table with 100 equally weighted entries behave differently than a table with 1000 equally weighted entries? #2, Does the "weight" of an entry -provided the weight is consistent entry to entry, influence the random pattern?  For example, if each entry was weighed at 10,000 across the board, instead of weighed at 1 across the board, do these differences effect the table behavior? Hopefully i explained my question a little better in this attempt & can find a successful resolution to the problem. Thanks a bunch!  :) 
Hey Goblintrain, The way that rollable tables work is that each table item's ID is loaded into an array. Then we choose a random number up to the number of items in the array, and that's the item that is chosen. When you use the weighting, it simply creates a bunch of "duplicate" entries in that array. So functionally speaking, a table with 10 items each with a weight of 1 and a table with 5 items each with a weight of 2 are equivalent. So you could equally weight each item with a weight of 10,000, but you're just creating more work for the computer to do the roll and the outcome should be the same. Regarding that thread the other day, at this point there's an easy way to test to see if rollable tables are random. Create a a simple table with 5 items, and weight each item with a weight of 10,000. Then do 10 or 20 rolls from the table and you should see that you get results from the whole table. As I said, this would be equivalent functionally to manually creating a table with 50,000 items in it, it's just much easier to see the distribution of the results this way. I've done a complete review of the code on the client side and I did not find any bugs or issues which were causing random tables to not be random. My guess is that if you do more than a few dozen rolls on your table, you will see results from the whole spectrum of possibilities. Sometimes randomness does not mean "equal distribution" when the sample size is small. That said, we did find a bug in the API which was affecting its ability to roll tables with more than around 9,000 entries (or weights that in total exceeded 9,000), but it was only affecting the API. We have since pushed out a fix for that bug as well, so all should be good to go. Let me know if that helps clear it up for you.
1457108624
The Aaron
Roll20 Production Team
API Scripter
I wrote some  scripts to gather statistics on Rollable Tables.  It uses a table with 131300 effective values ( 5050 for each of A-Z, 100 entries per letter with weights from 1 to 100). Here is a histogram with the distribution of 5000 rolls via the Client chat.  You can see it's fairly even across all letters: This is the same table rolled 5000 times from the API, showing the bug manifesting (A and B together have 10100 effective entries which is larger than Riley's approximately 9000):  Finally, here is the same table rolled 6200 times from the API after the bugfix.  You can see it's now pretty evenly distributed across all letters:
1457119241

Edited 1457119347
Seeing is believing...  well, usually, but i'll save the metaphysical discussions for in-game!  :)  This is really good information, & it helps me visualize what is going on. My basic policy is to steer clear of the API because if something goes wrong with it i don't know how to fix it.  Yes it limits me, but i'm just limited in general!  There are plenty of little API tools that would be great to use if i understood better how to import & implement them like your wee Recursive script, Aaron, but my brain is too sieve-like to learn much new material.  Hell, i can't even run an adventure module in Roll20 because i forget the encounter as soon as i've read it!  :) You guys are probably right about the distribution.  Just for my own amusement i may go through my table & play with the values for a bit & see what happens. In a 325 entry table it could easily just be one little typo somewhere causing the problem i thought i was observing anyway. But to not have to break this all down into multiple smaller tables is one important obstacle removed!
1457122721

Edited 1457122933
Silvyre
Forum Champion
Goblintrain said: My basic policy is to steer clear of the API because if something goes wrong with it i don't know how to fix it. My basic policy is, if something goes wrong with the API, to bug one of the benificent API hedge wizards (or archmages) to do something about it!
Silvyre, seeing as how that is one of the benefits my subscription pays for you are probably right, i just find myself too far behind the curve to use it.
1457138658
The Aaron
Roll20 Production Team
API Scripter
PM me if you'd like help setting some things up. :). I jump in lots of games to do that.