Description
The Gaussian4D
method is an extension method for the System.Random
class, allowing you to generate a random Vector4
value based on a Gaussian (normal) distribution. This method is useful for scenarios where you need to simulate random 4D vectors with a specific mean and standard deviation.
Usage
To use the Gaussian4D
method, you need to have an instance of System.Random
. You can specify the mean and standard deviation as Vector4
values. If either the mean or standard deviation is not provided, the method will use default values (zero vector for mean and unit vector for standard deviation).
Here is the method signature:
public static Vector4 Gaussian4D(this System.Random self, System.Nullable<Vector4> mean = null, System.Nullable<Vector4> stdDev = null)
Example
// Example usage of Gaussian4D
System.Random random = new System.Random();
Vector4 mean = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
Vector4 stdDev = new Vector4(0.5f, 0.5f, 0.5f, 0.5f);
Vector4 randomVector = random.Gaussian4D(mean, stdDev);
// randomVector now contains a Vector4 with values distributed around the specified mean and standard deviation.