Getting random point inside a non-rectangular shape?

I know it’s pretty easy to get random point inside box sized shape but what about shapes that doesn’t fit this criteria.

For example I have a square room with pillars at the corners like in the picture below, is there any known workflow on how to get random point inside of such shape?

right shape is my primary desired although I could settle for using squares at the corners instead of circles if that would be easier to achieve results with.

The closest solution to this that I can think of it setting up 5 bound boxes with 1 big in the center and 4 small at the circle shapes and later checking for difference if any point from the big one was placed inside not desired circles.
Although I can see it working this seems like a lot of work when solution might be easier than that, so do you think there is any better way to do it?

Alright, so I got this working with the solution I suggested. In retrospect it really wasn’t hard enough to seek help, I kind of jumped a gun and now feel a little stupid for asking such a question :sweat_smile:

Anyways, here’s a solution in c++ if anyone is interested.

	FBox SquareBox = FBox(SquareBounds); // SquareBounds consists of 4 FVectors for each corner
	// Shrink square box by 20 units
	SquareBox = FBox(SquareBox.Min + FVector(20, 20, 0), SquareBox.Max - FVector(20, 20, 0));
	// Draw debug box to show big SquareBox
	DrawDebugBox(GetWorld(), SquareBox.GetCenter(), SquareBox.GetExtent(), FColor::Green, false, 100, 0, 1);
	// Get some 1000 random coordinates inside PrisonBox extent
	for (int32 i = 0; i < 1000; i++)
	{
		FVector RandomPoint = Generator.GetRandomPointInBox(SquareBox, Stream);
		if (!Generator.IsPointInAnyCircle(RandomPoint, SquareBounds, 100))
		{
			DrawDebugBox(DungeonRef.GetWorld(), RandomPoint, FVector(5, 5, 5), FColor::Silver, false, 100, 0, 1);
		}
	}

GetRandomPointInBox and IsPointInAnyCircle functions

FVector GeneratorUtils::GetRandomPointInBox(const FBox& Box, FRandomStream& Stream)
{
	return FVector(Stream.FRandRange(Box.Min.X, Box.Max.X), Stream.FRandRange(Box.Min.Y, Box.Max.Y), Stream.FRandRange(Box.Min.Z, Box.Max.Z));
}

bool GeneratorUtils::IsPointInCircle(const FVector& Point, const FVector& Center, const float& Radius)
{
	return FVector::Dist(Point, Center) <= Radius;
}

bool GeneratorUtils::IsPointInAnyCircle(const FVector& Point, const TArray<FVector>& Centers, const float& Radius)
{
	for (const FVector& Center : Centers)
	{
		if (IsPointInCircle(Point, Center, Radius)) return true;
	}

	return false;
}