0
$\begingroup$

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.

  • 1
    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 clarify2012-08-23

1 Answers 1

2

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)$

  • 0
    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.2012-08-23