[deutsch]

# Generating pseudo-random numbers

Kontrast provides a function that generates pseudo-random numbers drawn according to a specified probability distribution.

There are two available distributions: uniform and gaussian that are specified with the property distribution. The number of random numbers to be generated is specified using the property count.

The uniform distribution requires to specify an inclusive lower limit (l, property lowerLimit) and an exclusive upper limit (u, property upperLimit). The probability distribution is:

The Gaussian distribution requires to specify the mean (\mu, property mean) and the standard deviation (\sigma, property standardDeviation). The probability distribution is:

p(x) = \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\left(-\frac{(x - \mu)^2}{2\sigma^2}\right)}

Kontrast relies on the function window.crypto.getRandomValues, which is designed to generate better pseudo-random numbers compared to Math.random.

## Input

The function is called as kontrast.generateRandomNumbers(options), where options is an object with the following properties:
• distribution: 'uniform' | 'gaussian'
The distribution according to which the random numbers are drawn.
• count: number
The length of the output array, i.e., the number of random numbers to be generated.
• lowerLimit: number
The lower limit for the random numbers (only applies to the uniform distribution).
• upperLimit: number
The lower limit for the random numbers (only applies to the uniform distribution).
• mean: number
The average of the distribution (only applies to the Gaussian distribution).
• standardDeviation: number
The standard deviation of the distribution (only applies to the Gaussian distribution).

## Output

• values: Float64Array
The generated pseudo-random numbers