Choose between multiple options with defined probability
Posted
by Sijin
on Stack Overflow
See other posts from Stack Overflow
or by Sijin
Published on 2010-06-11T20:45:45Z
Indexed on
2010/06/11
20:53 UTC
Read the original article
Hit count: 154
I have a scenario where I need to show a different page to a user for the same url based on a probability distribution,
so for e.g. for 3 pages the distribution might be
page 1 - 30% of all users
page 2 - 50% of all users
page 3 - 20% of all users
When deciding what page to load for a given user, what technique can I use to ensure that the overall distribution matches the above?
I am thinking I need a way to choose an object at "random" from a set X { x1, x2....xn } except that instead of all objects being equally likely the probability of an object being selected is defined beforehand.
© Stack Overflow or respective owner