Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a simple computer program that has to use the following weighted table to pick a random "payment" where the relative probabilities are given by "weight".

enter image description here

How does one interpret the table above and use it to determine how much to "pay"?

EDIT: After speaking with some folks it seems this table is simple enough that I can just create a table with 41 entries where each pay amount appears ( Weight times ) and select a random number between 0 and 40 and use that to index into the table.

share|cite|improve this question
You should ask your boss. – martin Aug 23 '12 at 22:18
@kxx Thanks for the help. – Chimera Aug 23 '12 at 22:19
So, you want to pick a random "payment" where the relative probabilities are given by "weight"? If that's not what you meant, please edit the question to clarify – Mooing Duck Aug 23 '12 at 23:04
up vote 2 down vote accepted

Assuming that the weight vector defines a finite probability distribution, you can sample payments as follows.

First pick a random integer $x \in [0, 41]$. Then the payment is as follows:

$0 \le x \le 20$ : $200 + 50 \lfloor x/3 \rfloor$

$21 \le x \le 38$ : $550 + 50 \lfloor (x-21)/2 \rfloor$

$39 \le x \le 41$ : $1000 + 500 (x - 39)$

share|cite|improve this answer
How do you get 41? Along with this table came the statement, "Can be changed to a table of 41 objects of equal probability. The 200 would appear on it 3 times." – Chimera Aug 23 '12 at 22:40
I ask because I'm just trying to understand how to interpret the table so the next time I get something like this I can figure it out myself. Thanks.. – Chimera Aug 23 '12 at 22:41
You probably got the table from an excel sheet, and excel probably has a function that samples the payment automatically given these two columns. Maybe you should ask someone who knows something about excel. – martin Aug 23 '12 at 22:51
Thanks for all of the help. However, I'm not interested in learning about Excel, I'm trying to understand how to use such a probability table in a program. I'm looking to understand the math behind it. – Chimera Aug 23 '12 at 23:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.