How would I get a random point in a selected area around an object

So I would like to randomly generate a Vector3 point in the green area, but I don’t want it to return a point inside of the red area (The red area is inside of green area)

How am I able to resolve this issue?

You could try get a random vector inside the green part and check if it is within the red part with region3.

Hmm well I’m looking for a more efficient way. I thought of that, but what if the red part covers 99% of the area? Then it would do it around 99 times until it gets it gets the green area. Looking for a way, which does it in 1 try.

I have no clue honestly. I found this, hope it helps: Get random position but with blacklisted areas - #3 by baseparts

1 Like

You could just divide up the green part into two type of sections:
Green part with no red
Green part with red
You would first get the size of each of each piece of green part with no red.
Add this up to get the total size, divide each one by total size to get percentage of time it should go in that one.

Then you do math.random between 0 and 1 to get the percentage, find which percentage range it falls into.

Then use normal math.random to get the random from inside that range.
ez

Would also be in one iteration, no need to repeat over and over.