PDA

View Full Version : How do you make a random d% chart as even as possible with odd numbers?



unseenmage
2014-12-11, 02:02 AM
I have several lists of items that I wish to roll a d% for. I get that I have to divide 100 by the number of items on the list but I get lost when I try to assign the remaining %s as evenly as possible across the list.

I know there should be a set of algebraic equations for this but I cannot for the life of me figure the rest of this out.


The real irritating bit is that I KNEW all this at some point in the past. 10-15 years ago I made all sorts of d% lists and assigned the remainders evenly and even balanced towards the middle of the list so the top and bottom didn't have too much of an unfair chance of being rolled. Somewhere along the line I forgot it all. Is super frustrating.

Any math-minded folk willing to lend me their brain for a while?

Edit: Solution achieved. Thanks Trisha for this answer I needed. (http://www.giantitp.com/forums/showsinglepost.php?p=18517122&postcount=21) And thank you everyone else who dropped by to help out.
I apologize for the confusion I caused by not being more able to make myself understood and I appreciate all of your patience.

Renen
2014-12-11, 02:10 AM
Not quite sure what the problem is but.. divide it evenly, and then grab any remainder % and make them "roll again"?

KillianHawkeye
2014-12-11, 02:11 AM
I don't know about an algebraic equation for this, but you can find the answer through some simple arithmetic. If the number of things doesn't divide evenly, then what you need to do is find the remainder. The remainder will be the number of items on the chart that need to have an extra percentage added to the base amount.


I'll do an example: Let's say you want to make a percentile chart with 23 different items.

You were right about the first step. Divide 100 / 23 which approximately equals 4.347.

So now you know the base chance is 4%, and you need to find the remainder. Subtract the 4 from the previous number, and then multiply is by 23. The resulting number is 8. (Alternatively, multiply the original number of items by the whole number portion and subtract that number from 100. 23 * 4 = 92, 100 - 92 = 8.) This tells you that 8 of the 23 items on the list should be increased to 5%.

As far as which ones should get the extra percentage point, I'll leave that decision up to you.

Extra Anchovies
2014-12-11, 02:27 AM
Not quite sure what the problem is but.. divide it evenly, and then grab any remainder % and make them "roll again"?

Exactly this. Simple and perfect.

NichG
2014-12-11, 02:31 AM
A general algorithm is to assign all the leftover empty slots to 'roll again'. That guarantees that everything is even at the cost of occasionally rolling multiple times. However, ideally you want to minimize the chance of a reroll result (e.g. imagine trying to pick from 21 items using a d100 this way - you'd reroll 79% of the time).

What you can do instead is use the nearest even division of 100 that is larger than the length of your list - this will generally be 25 or 50 because otherwise you'd be using a d20. For example, generating a d21 roll you could notice that 25 is 1/4 of 100. So you roll d100, divide by 4, and then pick out of a list of 25. In that case, you only have to reroll about 20% of the time - much more efficient. Still, the worst case scenario here is a list of 51 items - you still reroll half the time.

unseenmage
2014-12-11, 02:34 AM
Not quite sure what the problem is but.. divide it evenly, and then grab any remainder % and make them "roll again"?
Not applicable to the charts I have in mind. And with some odd numbers this makes for far far too much rerolling.


...

As far as which ones should get the extra percentage point, I'll leave that decision up to you.
This is exactly the part that I need assistance with because for my purposes they need to be assigned as evenly as possible tending towards the middle when applicable.


A general algorithm is to assign all the leftover empty slots to 'roll again'. That guarantees that everything is even at the cost of occasionally rolling multiple times. However, ideally you want to minimize the chance of a reroll result (e.g. imagine trying to pick from 21 items using a d100 this way - you'd reroll 79% of the time).

What you can do instead is use the nearest even division of 100 that is larger than the length of your list - this will generally be 25 or 50 because otherwise you'd be using a d20. For example, generating a d21 roll you could notice that 25 is 1/4 of 100. So you roll d100, divide by 4, and then pick out of a list of 25. In that case, you only have to reroll about 20% of the time - much more efficient. Still, the worst case scenario here is a list of 51 items - you still reroll half the time.

I actually just dealt with a list of 51 items. Was irritating. My wife finally figured out that two of the list items would have to be shortchanged and I assigned those two as evenly as I could (set them to the first and last items on the list). However we did this long hand and there are about ten more lists that need done.

NichG
2014-12-11, 03:17 AM
Location on the list doesn't matter. With 51 items and a d100, when you short-change two items they will always be half as likely as every other item on the list.

You could go to a d400/7 (e.g. floor( (d20 + 20*d20)/7), rerolling results above 51. Or, in list form, each item gets 8 slots, but a few items get 7. That way the effect of short-changing is much weaker.

unseenmage
2014-12-11, 03:21 AM
Location on the list doesn't matter. With 51 items, when you short-change two items they will always be half as likely as every other item on the list.

Placing them both at the top of the list makes the bottom of the list too light. Yes in the cas eof only two light items this difference is almost imperceptible but the larger the discrepancy the more this matters.

For my purposes I desire to know how to be able to assign the remainder evenly regardless of how high or low the discrepancy. Especially for lists that I intend to use often.

With a box
2014-12-11, 03:42 AM
Use http://random.org
Problem solved
You can set min and max of random number

NichG
2014-12-11, 03:43 AM
Why does the order of the list matter? If you're generating with a fair d100, a 73 is exactly as likely as a 15 or a 1 or a 100.

So if you have an entry with 1 row in your list, and every other entry has two rows, the entry with only one row will happen 1% of the time and every other entry will happen 2% of the time, and that doesn't depend on how you sort the entries. Something that happens on a 3, a 37, and on an 89 will happen with the same probability as something that happens on a 45-47.

Extra Anchovies
2014-12-11, 03:49 AM
If you want more accuracy, use 3d10 instead of 2d10, and emulate a d1000. Then, of 51 items, 31 items occur on 20 numbers and the other 20 items occur on 19 numbers. It increases accuracy by a lot.

If that's not enough, use 4d10. 47 items occur on 196 results, and 4 items occur on 197 results. That should be precise enough for you.


Use http://random.org
Problem solved
You can set min and max of random number

Rolling dice is fun, and some people don't like to game with computers open at all.

Trisha
2014-12-11, 03:58 AM
i am having trouble seeing what you mean about the bottom or top being too heavy, perhaps you could explain?
If you method of rolling is sufficiently random, ordinal number doesn't matter. e.g. you are as likely rolling a 6 as a 1 on a d6
and the list can be in any arbitrary order with no effect on the outcome.

however, since dice only deal with integers, you have to incorporate some form of rounding error.
say you are trying to make a list for 19 items, you would take 100/19 = 5.263 you round down to the nearest integer =5
multiply it by 19. 19x5 = 95, and therefore 96-100 would be rerolls.

in the case with 51, you would use the same method, but you can never roundup, because that would overshoot your goal.
therefore, you would have to deal with a large error underneath, which would be accounted for by re rolling, or you would
have to short an option like you did. but while not as tedious, you are ruining the fairness of your chart.

unseenmage
2014-12-11, 03:58 AM
Use http://random.org
Problem solved
You can set min and max of random number

Though this site is useful for rolling the die it isn't what I need for making a random d% chart. Still very cool though. Thanks for pointing it out.


Why does the order of the list matter? If you're generating with a fair d100, a 73 is exactly as likely as a 15 or a 1 or a 100.

So if you have an entry with 1 row in your list, and every other entry has two rows, the entry with only one row will happen 1% of the time and every other entry will happen 2% of the time, and that doesn't depend on how you sort the entries. Something that happens on a 3, a 37, and on an 89 will happen with the same probability as something that happens on a 45-47.

How could it not matter? If the list isn't as fair as possible it will show over time. Say the list is biased towards the top (where items at the top of a given list get more % chances to be rolled than items at the bottom of the chart) then over time low rolls will generate more random results than high rolls. Edit: scratch that, reverse it. Sorry.
The Random Weapon Tables are intentionally weighted so that 'Roll again' gets fewer % chances than +1 weapon enhancements. What I'm aiming for is to minimize weighting my charts by accident.

I know that it can be done I'm just stuck on how.

It also matter because this is a game and these charts are for people to roll on. People want to feel that their favorite monster or trap or weapon or terrain element or whatever isn't being biased against just because it is at the top or bottom of an alphabetized list. Even if that position doesn't mathematically matter rolling higher or lower matters to the person generally speaking.

sreservoir
2014-12-11, 03:59 AM
Not applicable to the charts I have in mind. And with some odd numbers this makes for far far too much rerolling.


This is exactly the part that I need assistance with because for my purposes they need to be assigned as evenly as possible tending towards the middle when applicable.



I actually just dealt with a list of 51 items. Was irritating. My wife finally figured out that two of the list items would have to be shortchanged and I assigned those two as evenly as I could (set them to the first and last items on the list). However we did this long hand and there are about ten more lists that need done.


Placing them both at the top of the list makes the bottom of the list too light. Yes in the cas eof only two light items this difference is almost imperceptible but the larger the discrepancy the more this matters.

For my purposes I desire to know how to be able to assign the remainder evenly regardless of how high or low the discrepancy. Especially for lists that I intend to use often.

... somehow, I don't think maths work for you way we usually assume them to work.

do you mean odd, as in for particular subjectively strange numbers, the methods works poorly? or odd, as in not even?
d100 has no central tendency. it is equally likely to roll any integer within 1-100 inclusive. position on the list should not matter.
therefore, your choice of positioning at the head and the foot of the list has no effect.
for what it's worth, one way to limit the amount of rerolling is to just limit the amount of rerolling and choose fallbacks. even in the 51 case with two d100 rolls, you can have 49 elements at 19.6% and two with 19.8% just by rolling two extra d10 (effectively d10000) if you use something equivalent to d100 = d10 * 10 - d10.
it's very unclear what you mean by "light"; the discrepancy is the same regardless of position

you're ... going to have to explain more clearly what about standard probability is inconsistent with your reality.

Heliomance
2014-12-11, 04:06 AM
I think the issue is that as he has it set up, higher rolls get better results than lower rolls. Thus, while he's fine with some list entries being more common than others, he wants the more common entries to be evenly distributed over the list, rather than making higher (better) entries or lower (worse) entries disproportionately common.

unseenmage
2014-12-11, 04:07 AM
i am having trouble seeing what you mean about the bottom or top being too heavy, perhaps you could explain?
If you method of rolling is sufficiently random, ordinal number doesn't matter. e.g. you are as likely rolling a 6 as a 1 on a d6
and the list can be in any arbitrary order with no effect on the outcome.

however, since dice only deal with integers, you have to incorporate some form of rounding error.
say you are trying to make a list for 19 items, you would take 100/19 = 5.263 you round down to the nearest integer =5
multiply it by 19. 19x5 = 95, and therefore 96-100 would be rerolls.

in the case with 51, you would use the same method, but you can never roundup, because that would overshoot your goal.
therefore, you would have to deal with a large error underneath, which would be accounted for by re rolling, or you would
have to short an option like you did. but while not as tedious, you are ruining the fairness of your chart.

THIS! You've almost got it. This is where I'm at now comprehension-wise. Now I need to eliminate the 'roll again' portion and replace it with weighting or shortchanging some parts of the chart. However, I desire that these shortchanges and/or weights occur at even intervals across the chart. I do not know how to achieve this last step.




I think I understand the disconnect now, I desire to not have a 'roll again' section when a 'roll again' section is the only way for the chart to be truly fair.
True fairness is less my goal than making the chart so that it only need be rolled on once. Evenly shortchanging or weighting the chart is preferrable for my purposes to having a 'roll again' section even if the latter is more fair.
Ease of using the chart taking precedence over fairness towards its elements.

Edit:
I think the issue is that as he has it set up, higher rolls get better results than lower rolls. Thus, while he's fine with some list entries being more common than others, he wants the more common entries to be evenly distributed over the list, rather than making higher (better) entries or lower (worse) entries disproportionately common.

This is correct too, in a way. My issue with not distributing the more or less common entries evenly across the list is that it would create a situation where rolling higher or lower on the list begets better or worse results.

Trisha
2014-12-11, 04:18 AM
This is correct too, in a way. My issue with not distributing the more or less common entries evenly across the list is that it would create a situation where rolling higher or lower on the list begets better or worse results.

oh well that is simple. simply divide your number of options by the remaining number of slots, if you did the items from lowest to highest in "value"
you will come up with something like this.

going back to my example of 19. 100/19 - 5.23 we round to 5, we find our remainder of 5 because 5(19)= 95

we then divide 19/5 = 3.8 so we round this to 3, and we would insert every third item in order. into the vacant slots, although at that point you can't be more accurate.
but that would mean if you had them listed in "value" it would keep a fairly equal distribution, without having more or less "value"

With a box
2014-12-11, 04:19 AM
Just make a table 1 to 51 each show once and go random.org
And set max at 51 and run it
What part of it is hard?

Extra Anchovies
2014-12-11, 04:21 AM
I think I understand the disconnect now, I desire to not have a 'roll again' section when a 'roll again' section is the only way for the chart to be truly fair.
True fairness is less my goal than making the chart so that it only need be rolled on once. Evenly shortchanging or weighting the chart is preferrable for my purposes to having a 'roll again' section even if the latter is more fair.
Ease of using the chart taking precedence over fairness towards its elements.

Did you see my 3d10/4d10 suggestion above? Adding another decimal place is very helpful for distributing numbers more fairly. Without a "reroll" section, 4d10 grows incrementally less and less accurate as the number of entries approaches 5000, but most d% tables don't have anywhere remotely near that many entries, and even if they did adding a "reroll" section would be insignificant (since it would only come up a few times in 10,000).

unseenmage
2014-12-11, 04:27 AM
oh well that is simple. simply divide your number of options by the remaining number of slots, if you did the items from lowest to highest in "value"
you will come up with something like this.

going back to my example of 19. 100/19 - 5.23 we round to 5, we find our remainder of 5 because 5(19)= 95

we then divide 19/5 = 3.8 so we round this to 3, and we would insert every third item in order. into the vacant slots, although at that point you can't be more accurate.
but that would mean if you had them listed in "value" it would keep a fairly equal distribution, without having more or less "value"

You are speaking my language but I'm still having a little trouble following you. I'm pretty sure this is what I'm after but I am having difficulty placing this process alongside the method I'm already using to make the charts up to this point.

Could you type out the whole process for making the chart as you see it?
I was about to type up my shorthand that I'm using for as much of the process as I'm able to get through but was honestly too embarrassed.
It is so frustrating to comprehend what the math can do but be unable to make it do what I want without the assistance of a calculator. Flusters me quite a bit sometimes.

Edit:

Just make a table 1 to 51 each show once and go random.org
And set max at 51 and run it
What part of it is hard?

For me personally? All of it.
And as stated earlier not everyone keeps a browser window open for their gaming needs. I'm sorry but I actually desire to roll the dice for this.
But again, that is a cool website and I will try to explore it farther after I've the answer to the question I am asking.


Did you see my 3d10/4d10 suggestion above? Adding another decimal place is very helpful for distributing numbers more fairly. Without a "reroll" section, 4d10 grows incrementally less and less accurate as the number of entries approaches 5000, but most d% tables don't have anywhere remotely near that many entries, and even if they did adding a "reroll" section would be insignificant (since it would only come up a few times in 10,000).

I am sorry but 1d100 is the die that I require for this project as I desire it to be similar to other major random charts and tables already provided for D&D 3.x.

I can comprehend that the solution you suggest is more fair or random but it, sadly, does not benefit me.
This is a case where I know you're being very helpful and to a normal person this solution is likely the right one but to my mind it is almost unintelligible.
Please forgive me as this is a flaw in my ability to compute and in no way reflective of any failing on your part.

Trisha
2014-12-11, 04:39 AM
Method is contained

suppose we have some number x where x is the number of options available.

you then divide 100 by x, this will give you a decimal, from which you round down (we will call this z).

multiply x by z, subtract this number from 100 to find the remainder (we will call the remainder R)

divide x by R, round this down (we will call the number N)

you then would move down the list of options, adding in one of them, each time you pass a multiple of N

if N is 3, you would pick the 3rd 6th... ect. or, one from the first group of three, one from the second group of three... ect.

how you choose between the ones in those groups is up to you.

but this would be the most accurate method i can think of to evenly distribute based on your order of value.

it won't be perfect, but if you really want to limit to one d100 roll it is probably the best distribution you will get.

unseenmage
2014-12-11, 04:44 AM
Method is contained

suppose we have some number x where x is the number of options available.

you then divide 100 by x, this will give you a decimal, from which you round down (we will call this z).

multiply x by z, subtract this number from 100 to find the remainder (we will call the remainder R)

divide x by R, round this down (we will call the number N)

you then would move down the list of options, adding in one of them, each time you pass a multiple of N

if N is 3, you would pick the 3rd 6th... ect. or, one from the first group of three, one from the second group of three... ect.

how you choose between the ones in those groups is up to you.

but this would be the most accurate method i can think of to evenly distribute based on your order of value.

it won't be perfect, but if you really want to limit to one d100 roll it is probably the best distribution you will get.

Oh wow. Thank you! That is exactly what I needed. I appreciate your help, and everyone's!

Now it is time for sleep. I will endeavor to employ this process tomorrow. I'll return here if I have any confusions.
Thanks again everyone.

Heliomance
2014-12-11, 06:07 AM
This is correct too, in a way. My issue with not distributing the more or less common entries evenly across the list is that it would create a situation where rolling higher or lower on the list begets better or worse results.

...no it wouldn't. If the outcomes at the high end of the chart aren't particularly better than the outcomes at the low end of the chart, then being more likely to roll them makes no difference.

Basically, no matter how you slice it, some entries are going to be more common than others. Grouping those more common entries in one part of the chart makes literally no difference unless the chart is arranged by power level.