Random Points in Rectangle

It doesn't get any easier than this :)

Just take a random coordinate on the length of each axis of the rectangle.

/// <summary>Returns a random point within a rectangle</summary>
/// <param name="randomNumberGenerator">Random number generator that will be used</param>
/// <param name="extents">Extents of the rectangle</param>
/// <returns>A random point within the rectangle</returns>
public static Vector2 GenerateRandomPointWithin(
  System.Random randomNumberGenerator, Vector2 extents
) {

  float x = (float)randomNumberGenerator.NextDouble() * 2.0f - 1.0f;
  float y = (float)randomNumberGenerator.NextDouble() * 2.0f - 1.0f;

  return new Vector2(x * extents.X, y * extents.Y);

}