Return boolean based on chance


It’s a simple question, but I cannot figure it out. Say I have a list of values between 1 and 0 and I would like to receive either True or False value based on chance; so that 0,5 would mean a 50% chance of returning True, 0,25 would mean 25% chance of returning True and so on.

Thanks for help!

I don’t know how you can guarantee that you’ll get exactly 25 Trues, for example, but this is one possible approach.

Have a look at this and see if it works for you:

191213 (16.6 KB)
The grouped part was only for checking if the output approximately results in the matching percentage by generating 10000 “random” numbers.

Thanks for the kind replies, all of the solutions have been helpful for me!