First you have to assign a probability value to each possible choice. For your example, you might choose:
item 1 - .35
item 2 - .35
item 3 - .25
item 4 - .05
What do those numbers mean? Well, item 1 and item 2 both have a 35% chance of being chosen. So 70% of the time, which is most often.
item 3 has a 25% chance of being chosen. That is much less often than the 70% item 1 or 2, so that is sometimes.
item 4 only gets picked 5% of the time, that is rarest.
You can adjust the numbers to suite your needs, but it is important that they add up to exactly 1. (100%).
Then, you generate a random number between 0 and 1, and use an if else chain to decide which item to pick. Pseudo-code:
r = random()
if r < .35
? ?pick = item1
else if r < .70 // .35 + .35
? ?pick = item2
else if r < .95 // .35 + .35 + .25
? ?pick = item3
else
? ?pick = item4
Note that the value you compare r to is the sum of the previous and current probability. If you think about that a little bit, I think you'll get it.
In excel you can implement the Ratchetr's idea.
- 1 column for the random-number (rand() function)
- 1 column for the if function to store the selected item
This is going to get confusing so let's see how I do.
Let's say I have a spreadsheet with four entries, like so
http://i.imgur.com/c1Lfc2E.jpg
Now if these four items are in a bag, and someone reaches in randomly, there would be a 25% chance of picking each one.
However, instead of the probability being the same, I want the ones with a higher 'probability' number to be rarely chosen.
So in the case of the 4 items, item 1 and 2 would be chosen most often, item 3 sometimes, and item 4 the rarest.
Is there any way to do this with any program, online or downloadable? Preferably Excel, but any program?