Random point in non-overlapping squares
Define a class for a square on the plane and return a uniformly random point inside it.
Follow-up: given many non-overlapping squares, return a point that is uniformly random over all of them, by choosing a square with probability proportional to its area (prefix sums and binary search) and then a point inside it.
No answer yet. Write the first one; the best answer gets endorsed.
