public static int2 ChooseRandomCell(this World w, Thirdparty.Random r) { return new int2( r.Next(w.Map.XOffset, w.Map.XOffset + w.Map.Width), r.Next(w.Map.YOffset, w.Map.YOffset + w.Map.Height)); }
// Sampled a N-sample probability density function in the range [-1024..1024] // 1 sample produces a rectangular probability // 2 samples produces a triangular probability // ... // N samples approximates a true gaussian public static WRange FromPDF(Thirdparty.Random r, int samples) { return new WRange(Exts.MakeArray(samples, _ => r.Next(-1024, 1024)) .Sum() / samples); }
public static int2 ChooseRandomCell(this World w, Thirdparty.Random r) { return new int2( r.Next(w.Map.Bounds.Left, w.Map.Bounds.Right), r.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom)); }