# Random Random number generation utilities and weighted random point functions. - - - ## ERandomDir Direction bias for random number generation (LEFT, MEAN, RIGHT). - - - ## ERandomDistribution Distribution type for random generation (RANDOM or GAUSS). - - - ## RandomBoolean ```pascal function RandomBoolean(): Boolean; function RandomBoolean(probability: Double): Boolean; overload; ``` Returns a random boolean. Optionally weighted by probability (0.0-1.0). - - - ## Sleep (overload) ```pascal procedure Sleep(min, max: UInt32; dir: ERandomDir = ERandomDir.LEFT); overload; ``` Sleeps for a random duration between min and max, biased by direction. - - - ## TPoint.RandomBetween ```pascal function TPoint.RandomBetween(other: TPoint): TPoint; ``` Returns a random point on the line between Self and other. - - - ## TPointArray.RandomMean ```pascal function TPointArray.RandomMean(): TPoint; ``` Returns a random point from the array, weighted towards the mean. - - - ## TCircle.RandomSkewedPoint ```pascal function TCircle.RandomSkewedPoint(from: TPoint; force: Double = 0.35): TPoint; ``` Generates a random point within the circle, skewed towards `from`. - - - ## TCircle.RandomWeightedPoint ```pascal function TCircle.RandomWeightedPoint(from: TPoint; weight: Single = 10.0; bias: Single = 1): TPoint; ``` Generates a random point within the circle, weighted towards `from`. Credits: [slacky](https://slacky.one/) - - - ## TTriangle.RandomSkewedPoint ```pascal function TTriangle.RandomSkewedPoint(from: TPoint; force: Double = 0.35): TPoint; ``` Generates a random point within the triangle, skewed towards `from`. - - - ## RandomWeightedPoint ```pascal function TTriangle.RandomWeightedPoint(from: TPoint; weight: Single = 10.0; bias: Single=1): TPoint; function TPolygon.RandomWeightedPoint(from: TPoint; weight: Single = 10.0; bias: Single=1): TPoint; function TQuad.RandomWeightedPoint(from: TPoint; weight: Single = 10.0; bias: Single=1): TPoint; function TBox.RandomWeightedPoint(from: TPoint; weight: Single = 10.0; bias: Single=1): TPoint; ``` Generates a random point within the TTriangle, drawn towards a `from` point. Parameters: - from: The point towards which the distribution is drawn. - weight: Controls the strength of attraction towards the `from` (higher values = stronger attraction). - weight = 0 gives a uniform distribution. - bias: Introduces a Gaussian spread around the `from` (higher values = wider spread). - bias = 0 gives a purely weighted distribution towards the `from`. Should expose weight and bias to the user if used as mouse distribution method. Credits: [slacky](https://slacky.one/) - - - ## TPolygon.RandomPoint ```pascal function TPolygon.RandomPoint(): TPoint; ``` Generates a uniformly distributed random point within the polygon. Credits: torwent - - - ## TPolygon.RandomPointCenter ```pascal function TPolygon.RandomPointCenter(): TPoint; ``` Generates a random point within the polygon, weighted towards the center. Credits: bootie - - - ## TPolygon.RandomSkewedPoint ```pascal function TPolygon.RandomSkewedPoint(from: TPoint): TPoint; ``` Generates a random point within the polygon, skewed towards `from`. - - - ## TQuad.RandomSkewedPoint ```pascal function TQuad.RandomSkewedPoint(from: TPoint; force: Double = 0.35): TPoint; ``` Generates a random point within the bounds of the TQuad, the point generated is skewed towards towards the `from`-point. The last parameter `force` defines how much the generated point is to be skewed towards or away from `from` - Expects value in the range 0..2 - force = 0: Result weighs heavily towards the edge closest to `From` - force = 1: Result in the middle of box is most common - force = 2: Result weighs heavily towards the edge furthest away from `From` - - - ## TBox.RandomSkewedPoint ```pascal function TBox.RandomSkewedPoint(from: TPoint; force: Double = 0.35): TPoint; ``` Generates a random point within the bounds of the TBox, the point generated is skewed towards the `from`-point. The last parameter `force` defines how much the generated point is to be skewed towards or away from `from` - Expects value in the range 0..2 - force = 0: Result weighs heavily towards the edge closest to `From` - force = 1: Result in the middle of box is most common - force = 2: Result weighs heavily towards the edge furthest away from `From`