Getting random point inside a non-rectangular shape?

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;
}