random-sampling
2024-10-12
Functions to generate random samples with various distributions
# About Random-Sampling
This library provides additional functions used in statistics or random generation. It provides a variety of distribution functions to provide a biased random number generation and generators for random numbers on 3D volumes.
## How To
This library relies on ''random-state''(https://github.com/shinmera/random-state) for uniform random number generation. As such, you can pick from a variety of underlying sources of randomness to drive the other algorithms in this library. For multivariate distributions such as over volumes, it relies on the ''3d-math''(https://github.com/shinmera/3d-math) library for vector and matrix representation.
To generate samples, simply invoke one of the various functions exposed by this library. To influence the underlying random source, set or bind the ``org.shirakumo.random-state:*generator*``.
Sampling for the following volume types is available:
- ``box``
- ``convex-mesh``
- ``cylinder``
- ``disc``
- ``half-sphere``
- ``normal``
- ``pill``
- ``sphere``
- ``triangle``
The following distribution functions are available:
- ``bernoulli``
- ``beta``
- ``binomial``
- ``-binomial``
- ``cauchy``
- ``chi-squared``
- ``exponential``
- ``fdist``
- ``flat``
- ``gamma``
- ``gaussian-tail``
- ``gaussian``
- ``geometric``
- ``gumbel-1``
- ``gumbel-2``
- ``laplace``
- ``levy-skew``
- ``levy``
- ``logarithmic``
- ``logistic``
- ``lognormal``
- ``pareto``
- ``poisson``
- ``rayleigh-tail``
- ``rayleigh``
- ``tdist``
- ``weibull``
Most distributions also have their probility density function available. You can retrieve it via the ``pdf`` function. Every distribution function also has a ``random-state:generator`` of the same name defined. Those generators rely on an underlying generator ``source`` to draw randomness from, and will then turn that into a random float biased according to the distribution.