Functions to generate random samples with various distributions https://shinmera.com/docs/random-sampling
  • Common Lisp 100%
Find a file
2025-08-20 16:12:56 +02:00
docs Doc update 2025-08-20 16:12:56 +02:00
distributions.lisp Add a common supertype for generators 2024-01-24 14:52:20 +01:00
documentation.lisp Add ring volume sampler 2025-05-15 12:01:50 +02:00
LICENSE init 2024-01-18 15:28:32 +01:00
package.lisp Add ring volume sampler 2025-05-15 12:01:50 +02:00
random-sampling.asd Update linkage 2025-08-11 21:26:21 +02:00
README.mess Update linkage 2025-08-11 21:26:21 +02:00
staple.ext.lisp Implement convex-mesh sampling 2024-01-21 12:22:49 +01:00
test.lisp Minor 2024-01-21 16:39:03 +01:00
toolkit.lisp Add PLOT-PDF (todo: use it in docstrings and backport to text-draw) 2025-05-14 22:39:32 +02:00
volumes.lisp Add ring volume sampler 2025-05-15 12:01:50 +02:00

# 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://shinmera.com/project/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://shinmera.com/project/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.