I currently have the following code to generate a random number between the constraints of B9 and B8 (dynamic):
Randomize
MyValue = Int((Range("B9") - Range("B8")) * Rnd + 0.5) + Range("B8")
As it currently is calculated, each number in that range of B8:B9 (ex: 1-4) is weighted equally and given the same chance of being selected as a random number.....
I would like to incorporate a set of cells that allow the user to assign a specific weight/probability of the values inbetween the range B8:B9 (ex: 1-4).
So: Instead of chances 1-4 all having a 25% chance of being returned by the code, I would like to be able to say for each spot
Spot 1: 10%
Spot 2: 30%
Spot 3: 40%
Spot 4: 20%
etc. That way, Spot 3 actually has a 40% chance of being selected (rather than 25%).
Does anyone know how to adapt the code i have to get this....or new code?
Thanks in advance!
Randomize
MyValue = Int((Range("B9") - Range("B8")) * Rnd + 0.5) + Range("B8")
As it currently is calculated, each number in that range of B8:B9 (ex: 1-4) is weighted equally and given the same chance of being selected as a random number.....
I would like to incorporate a set of cells that allow the user to assign a specific weight/probability of the values inbetween the range B8:B9 (ex: 1-4).
So: Instead of chances 1-4 all having a 25% chance of being returned by the code, I would like to be able to say for each spot
Spot 1: 10%
Spot 2: 30%
Spot 3: 40%
Spot 4: 20%
etc. That way, Spot 3 actually has a 40% chance of being selected (rather than 25%).
Does anyone know how to adapt the code i have to get this....or new code?
Thanks in advance!