random sampling
0.0.0Functions 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 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 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:
The following distribution functions are available:
Most distributions also have their probility density function available. You can retrieve it via the pdf
function.
System Information
Definition Index
-
ORG.SHIRAKUMO.RANDOM-SAMPLING
No documentation provided.-
EXTERNAL FUNCTION -BINOMIAL
- P
- N
- &OPTIONAL
- RESULT0
Draws a sample from the negative binomial distribution. See BINOMIAL See -BINOMIAL-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION -BINOMIAL-PDF
- X
- P
- N
-
EXTERNAL FUNCTION BERNOULLI
- P
- &OPTIONAL
- RESULT0
Draws a sample from the Bernoulli distribution. See BERNOULLI-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION BERNOULLI-PDF
- X
- P
-
EXTERNAL FUNCTION BETA
- A
- B
- &OPTIONAL
- RESULT0
Draws a sample from the beta distribution. See BETA-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION BETA-PDF
- X
- A
- B
-
EXTERNAL FUNCTION BINOMIAL
- P
- N
- &OPTIONAL
- RESULT0
Draws a sample from the binomial distribution. See -BINOMIAL See BINOMIAL-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION BINOMIAL-PDF
- X
- P
- N
-
EXTERNAL FUNCTION BOX
- BSIZE
- &OPTIONAL
- RESULT0
Samples a uniform box. BSIZE should be the half-size of the box in each direction, with the box being centered at 0,0,0. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION CAUCHY
- A
- &OPTIONAL
- RESULT0
Draws a sample from the Cauchy distribution. See CAUCHY-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION CAUCHY-PDF
- X
- A
-
EXTERNAL FUNCTION CHI-SQUARED
- NU
- &OPTIONAL
- RESULT0
Draws a sample from the chi-squared distribution. See CHI-SQUARED-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION CHI-SQUARED-PDF
- X
- NU
Computes the probability density of the given sample X under the chi-squared distribution. See PDF See CHI-SQUARED
-
EXTERNAL FUNCTION CONVEX-MESH
- VERTICES
- FACES
- &OPTIONAL
- RESULT0
Samples a uniform convex mesh. VERTICES must be a (SIMPLE-ARRAY SINGLE-FLOAT (*)) that contains the packed representation of the vertex coordinates. FACES must be a (SIMPLE-ARRAY (UNSIGNED-BYTE 16) (*)) that contains the packed indices of the vertices that compose the faces. The vertices of each face must occur in counter-clockwise order. Both arrays must have a length that is a multiple of 3. The consequences are undefined if the mesh described by VERTICES and FACES is not convex and manifold. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION CYLINDER
- RADIUS
- HEIGHT
- &OPTIONAL
- NORMAL
- RESULT0
Samples a uniform cylinder. HEIGHT is the half-height of the cylinder with the cylinder's center always at 0,0,0. NORMAL may be a normalised vector pointing in the UP direction of the cylinder. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION DISC
- &OPTIONAL
- RADIUS
- NORMAL
- RESULT0
Samples a uniform disc. NORMAL may be a normalised vector pointing in the UP direction of the disc's plane. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION EXPONENTIAL
- MU
- &OPTIONAL
- RESULT0
Draws a sample from the exponential distribution. See EXPONENTIAL-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION EXPONENTIAL-PDF
- X
- MU
Computes the probability density of the given sample X under the exponential distribution. See PDF See EXPONENTIAL
-
EXTERNAL FUNCTION FDIST
- NU-1
- NU-2
- &OPTIONAL
- RESULT0
Draws a sample from the F distribution. See FDIST-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION FDIST-PDF
- X
- NU-1
- NU-2
-
EXTERNAL FUNCTION FLAT
- A
- B
- &OPTIONAL
- RESULT0
Draws a sample from the flat distribution. See FLAT-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION FLAT-PDF
- X
- A
- B
-
EXTERNAL FUNCTION GAMMA
- A
- &OPTIONAL
- B
- RESULT0
Draws a sample from the gamma distribution. See GAMMA-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION GAMMA-PDF
- X
- A
- &OPTIONAL
- B
-
EXTERNAL FUNCTION GAUSSIAN
- &OPTIONAL
- SIGMA
- RESULT0
Draws a sample from the Gaussian distribution. See GAUSSIAN-TAIL See GAUSSIAN-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION GAUSSIAN-PDF
- X
- &OPTIONAL
- SIGMA
-
EXTERNAL FUNCTION GAUSSIAN-TAIL
- A
- &OPTIONAL
- SIGMA
- RESULT0
Draws a sample from the Gaussian-tail distribution. See GAUSSIAN See GAUSSIAN-TAIL-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION GAUSSIAN-TAIL-PDF
- X
- A
- &OPTIONAL
- SIGMA
Computes the probability density of the given sample X under the Gaussian-tail distribution. See PDF See GAUSSIAN-TAIL
-
EXTERNAL FUNCTION GEOMETRIC
- P
- &OPTIONAL
- RESULT0
Draws a sample from the geometric distribution. See GEOMETRIC-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION GEOMETRIC-PDF
- X
- P
-
EXTERNAL FUNCTION GUMBEL-1
- A
- B
- &OPTIONAL
- RESULT0
Draws a sample from the Gumbel-1 distribution. See GUMBEL-1-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION GUMBEL-1-PDF
- X
- A
- B
-
EXTERNAL FUNCTION GUMBEL-2
- A
- B
- &OPTIONAL
- RESULT0
Draws a sample from the Gumbel-2 distribution. See GUMBEL-2-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION GUMBEL-2-PDF
- X
- A
- B
-
EXTERNAL FUNCTION HALF-SPHERE
- &OPTIONAL
- NORMAL
- RADIUS
- RESULT0
Samples a uniform half-sphere. RADIUS may either be a real of the radius, or a VEC3 to generate an ellipsoid. NORMAL may be a normalised vector pointing in the UP direction of the half-sphere. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION LAPLACE
- A
- &OPTIONAL
- RESULT0
Draws a sample from the Laplace distribution. See LAPLACE-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION LAPLACE-PDF
- X
- A
-
EXTERNAL FUNCTION LEVY
- C
- ALPHA
- &OPTIONAL
- RESULT0
Draws a sample from the Levy distribution. See LEVY-SKEW See MAP-SAMPLES
-
EXTERNAL FUNCTION LEVY-SKEW
- C
- ALPHA
- BETA
- &OPTIONAL
- RESULT0
Draws a sample from the Levy-skew distribution. See LEVY See MAP-SAMPLES
-
EXTERNAL FUNCTION LOGARITHMIC
- P
- &OPTIONAL
- RESULT0
Draws a sample from the logarithmic distribution. See LOGARITHMIC-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION LOGARITHMIC-PDF
- X
- P
Computes the probability density of the given sample X under the logarithmic distribution. See PDF See LOGARITHMIC
-
EXTERNAL FUNCTION LOGISTIC
- A
- &OPTIONAL
- RESULT0
Draws a sample from the logistic distribution. See LOGISTIC-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION LOGISTIC-PDF
- X
- A
-
EXTERNAL FUNCTION LOGNORMAL
- ZETA
- SIGMA
- &OPTIONAL
- RESULT0
Draws a sample from the lognormal distribution. See LOGNORMAL-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION LOGNORMAL-PDF
- X
- ZETA
- SIGMA
-
EXTERNAL FUNCTION MAP-SAMPLES
- RESULT
- SAMPLE-1
Gathers samples into RESULT, drawing them from SAMPLE-1. RESULT may be one of the following: NULL --- A single single-float is sampled and returned INTEGER --- An array of result size is sampled and returned SEQUENCE --- Each element of the sequence is set to a fresh sample SAMPLE-1 must be a function of zero arguments and must return the freshly drawn sample as a single-float. This function is implicitly used by every distribution sampling function. The optional RESULT argument of those functions corresponds to the above.
-
EXTERNAL FUNCTION MAP-VOLUME-SAMPLES
- RESULT
- SAMPLE-1
Gathers samples into RESULT, drawing them from SAMPLE-1. RESULT may be one of the following: NULL --- A fresh VEC3 is sampled and returned VEC3 --- The result is sampled and returned INTEGER --- An array of result size is sampled and returned SEQUENCE --- Each element of result is sampled and result is returned. Each element of result must be a VEC3 SAMPLE-1 must be a function of one argument, a VEC3, and must return said VEC3 after performing its sampling operation to fill the vector's elements. This function is implicitly used by every volume sampling function. The optional RESULT argument of those functions corresponds to the above.
-
EXTERNAL FUNCTION NORMAL
- &OPTIONAL
- RADIUS
- RESULT0
Samples a uniform normal vector. This is equivalent to sampling the surface of a sphere. RADIUS may either be a real of the radius, or a VEC3 to generate an ellipsoid. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION PARETO
- A
- B
- &OPTIONAL
- RESULT0
Draws a sample from the Pareto distribution. See PARETO-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION PARETO-PDF
- X
- A
- B
-
EXTERNAL FUNCTION PDF
- DISTRIBUTION
- &OPTIONAL
- ERRORP
Returns the probability density function for the given distribution. The distribution must be given as a name. If no PDF exists, and errorp is true, an error is signalled. Every PDF takes the same arguments as its corresponding distribution function, plus an additional first argument, which is the sample for which to evaluate the PDF.
-
EXTERNAL FUNCTION PILL
- RADIUS
- HEIGHT
- &OPTIONAL
- NORMAL
- RESULT0
Samples a uniform pill. A pill is a cylinder with its caps being spheres. HEIGHT is the half-height of the pill cylinder with the pill's center always at 0,0,0. If the height is zero, this is equivalent to a sphere. NORMAL may be a normalised vector pointing in the UP direction of the cylinder. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION POISSON
- MU
- &OPTIONAL
- RESULT0
Draws a sample from the Poisson distribution. See POISSON-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION POISSON-PDF
- X
- MU
-
EXTERNAL FUNCTION RAYLEIGH
- SIGMA
- &OPTIONAL
- RESULT0
Draws a sample from the Rayleigh distribution. See RAYLEIGH-TAIL See RAYLEIGH-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION RAYLEIGH-PDF
- X
- SIGMA
-
EXTERNAL FUNCTION RAYLEIGH-TAIL
- A
- SIGMA
- &OPTIONAL
- RESULT0
Draws a sample from the Rayleigh-tail distribution. See RAYLEIGH See RAYLEIGH-TAIL-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION RAYLEIGH-TAIL-PDF
- X
- A
- SIGMA
Computes the probability density of the given sample X under the Rayleigh-tail distribution. See PDF See RAYLEIGH-TAIL
-
EXTERNAL FUNCTION REJECTION-SAMPLE
- GENERATOR
- PREDICATE
- &OPTIONAL
- RESULT0
Perform rejection sampling using GENERATOR to draw samples and PREDICATE to determine whether to keep the sample. GENERATOR must be a function of one argument, the VEC3 to sample. PREDICATE must be a function of one argument, the VEC3 to examine, and must return true if the sample is suitable. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION SPHERE
- &OPTIONAL
- RADIUS
- RESULT0
Samples a uniform sphere. RADIUS may either be a real of the radius, or a VEC3 to generate an ellipsoid. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION TDIST
- NU
- &OPTIONAL
- RESULT0
Draws a sample from the T distribution. See TDIST-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION TDIST-PDF
- X
- NU
-
EXTERNAL FUNCTION TRIANGLE
- P0
- P1
- P2
- &OPTIONAL
- RESULT0
Samples a uniform triangle. P0, P1, P2 designate the corners of the triangle. See MAP-VOLUME-SAMPLES
-
EXTERNAL FUNCTION WEIBULL
- A
- B
- &OPTIONAL
- RESULT0
Draws a sample from the Weibull distribution. See WEIBULL-PDF See MAP-SAMPLES
-
EXTERNAL FUNCTION WEIBULL-PDF
- X
- A
- B
-