Roulette wheel style selection.


I would appreciate some help.

I have an array of floats. Each has a certain weight/value. Sum of those weights/values = 100%.
I want to randomly select one of the floats but to take into the account their weight. So if one of the floats has 0.60 value for example, chance to randomly select it will be 60%.

I can’t seem to wrap my head around on how to do it. I would appreciate some advice.
I’m a beginner in blueprints, so please don’t hate if its a very stupid question. :slight_smile:


What are you trying to do?
you have values like cookie, pizza, cake
and values like 50%, 25%, 25%
and you want to make cookie be 2x the chance of pizza or cake?
if so you can use this node

and you could set the max to 100
then just convert your %chance to its number
then branch
you could assign cookie 0-49
pizza 50-74
and cake 75-99
that is the easiest way I can think of to program that but I am no expert just an idea.