Cull based reduction based on percentage

I have been trying to map the values of image sample (range 0 tot 1) to cull a list of object, where a value defines the chance of removing an object from the list (sort of like a weighted factor)

So:
value 0 will result in False
value 1 always in True,
but a value of 0.3, should result in a 30% chance to give False, and a 70% chance True.

I recall i have seen a way to achieve this, but cannot seem to find it. Any help is much appriciated

You can compare the value to a randomly generates number between zero and one. The distribution of random numbers will be flat over large enough sample sizes, meaning that a bitmap value of 0.3 will be smaller than a random value 30% of the time.

Hi David, Thanks for the feedback. I sort made what you suggested, but it seems that a smarter way must exist. A sample size of 10 in this case works, but for larger meshes this will ultimately slow things down. Also the method I now have doesn’t seem to be fully working as expected, see the left and right edges. Any thoughts on how to make this definition smarter and faster?. Image Sampler to Cull Geometry.gh (34.7 KB)
gradient_GH gradient