/// <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; } } } }
public override int Next(int maxValue) => (int)(_parent.Sample() * maxValue);
public static Color Get(int seed, float alpha) { var random = new System.Random(seed); return(new Color(random.Sample(), random.Sample(), random.Sample(), alpha)); }
/// <summary> /// Creates a random distribution of points. /// </summary> public static IEnumerable<Point> RandomDistribution(Random Random, int Amount) { while (Amount > 0) { yield return new Point(Random.Sample(), Random.Sample()); Amount--; } }