/// <summary>
/// Creates a grid-like distribution of points.
/// </summary>
/// <param name="Size">The edge-length of the grid.</param>
/// <param name="Error">The amount each grid point is moved relative to the space between grid points.</param>
/// <param name="Probability">The probability that a certain grid point will be used.</param>
public static IEnumerable<Point> GridDistribution(Random Random, int Size, double Error, double Probability)
{
double delta = 1.0 / Size;
Error *= delta;
double off = delta * 0.5 - Error * 0.5;
for (int x = 0; x < Size; x++)
{
for (int y = 0; y < Size; y++)
{
if (Random.Sample() < Probability)
{
Point p = new Point(x * delta, y * delta);
p.X += off + Random.Sample() * Error;
p.Y += off + Random.Sample() * Error;
yield return p;
}
}
}
}