protected S2Cap getRandomCap(double minArea, double maxArea) { var capArea = maxArea * Math.Pow(minArea / maxArea, rand.NextDouble()); Assert.True(capArea >= minArea && capArea <= maxArea); // The surface area of a cap is 2*Pi times its height. return(S2Cap.FromAxisArea(randomPoint(), capArea)); }