Math, asked by pranasya8838, 9 months ago

Probability randome number picker with lower prob of higher number

Answers

Answered by Anonymous
2

Step-by-step explanation:

  1. Just thinking: another possibility is to get rid of the fractions by multiplying with a constant multiplier, and then build an array with the size of this multiplier. Multiplying by 10 you get
  2. P(1) = 2
  3. P(2) = 3
  4. P(3) = 5
  5. Then you create an array with the inverse values -- '1' goes into elements 1 and 2, '2' into 3 to 6, and so on:
  6. P = (1,1, 2,2,2, 3,3,3,3,3);
  7. and then you can pick a random element from this array instead.
Similar questions