[7 / 2 / ?]
Quoted By: >>614182
Suppose I have a vector of real numbers that are all between 0 and 1 inclusive (call these numbers probabilities), which all have a corresponding index number, for example:
1 -> 0.7
2 -> 0.4
3 -> 1
4 -> 0.3
5 -> 0.5
Now suppose I want a general function that when used with the example above returns the number 1 with probability 0.7, the number 2 with probability 0.4 and so on. However, it is obviously impossible to return the number 3 with probability 100% while all the other probabilities still hold, so there should be a balancing factor that makes it so that if e.g. 2 of the elements of the vector had probability 100% and the rest were all 0%, the 2 elements with 100% probability would both end up having a 50% chance of being selected. What would such a function be?
1 -> 0.7
2 -> 0.4
3 -> 1
4 -> 0.3
5 -> 0.5
Now suppose I want a general function that when used with the example above returns the number 1 with probability 0.7, the number 2 with probability 0.4 and so on. However, it is obviously impossible to return the number 3 with probability 100% while all the other probabilities still hold, so there should be a balancing factor that makes it so that if e.g. 2 of the elements of the vector had probability 100% and the rest were all 0%, the 2 elements with 100% probability would both end up having a 50% chance of being selected. What would such a function be?