I'm trying to make a randomizer that will use the Monte Carlo Heath method or miss simulation.
I have a Key-Value pair that represents an identifier and a probability value:
ID - Value
2 - 0.37
1 - 0.35
4 - 0.14
3 - 0.12
When you add all these values, you get a total of 1.0.
You can imagine these values as the total “cut” area on the “wheel” (EG: ID 2 takes up 37% of the wheel, and ID 3 takes up only 12% of the wheels). When it is converted to a "range", it will look like this:
ID - Value - Range
2 - 0.37 - 0 to 37
1 - 0.35 - 37 to 72
4 - 0.14 - 72 to 86
3 - 0.12- 86 to 100
Now I use Random.NextDouble () to generate a random value that is between 0.0 and 1.0. This random value will be considered a “spin” on the wheel. Let's say the randomizer returns 0.35, then ID 2 will be selected.
, , ?