sample_distribution_discrete#

atompy.sample_distribution_discrete(values, probabilities, size)[source]#

Sample a discrete distribution of values, where the probability is given by probabilities.

Parameters:
valuesndarray

Values that the samples can take.

probabilitiesndarray

Corresponding probabilities.

sizeint

Size of the distribution

Returns:
samplesndarray

Notes

Be aware of Moiré patterns when resampling/rebinning the output.

See also Sample a random distribution.