This is the cl-variates Reference Manual, version 0.9.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:29:52 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-variates
Portable Common Lisp Random Number Generation.
Gary Warren King <gwking@metabang.com>
Gary King <gwking@metabang.com>
MIT Style License
0.9.0
Modules are listed depth-first from the system components tree.
cl-variates/dev
cl-variates
(system).
package.lisp
(file).
variates.lisp
(file).
cl-variates/website
cl-variates
(system).
source
(module).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-variates/cl-variates.asd
cl-variates
(system).
cl-variates/dev/variates.lisp
package.lisp
(file).
dev
(module).
*probability-of-heads*
(special variable).
*random-generator*
(special variable).
basic-random-number-generator
(class).
binomial
(function).
exponential-random
(function).
flip
(function).
geometric
(function).
initialize-instance
(method).
initialize-instance
(method).
initialize-instance
(method).
integer-random
(function).
make-random-number-generator
(function).
next-element
(generic function).
normal-random
(function).
ran1-random-number-generator
(class).
rand
(function).
random-boolean
(function).
random-element
(function).
random-number-generation-mixin
(class).
random-number-generator
(reader method).
random-number-generator-class
(reader method).
random-range
(function).
random-range-inclusive
(function).
random-seed
(generic function).
(setf random-seed)
(generic function).
ranq1-random-number-generator
(class).
sample-sequence
(function).
select-sample
(function).
shuffle-elements!
(generic function).
uniform-random
(function).
am
(reader method).
current-value
(reader method).
exponential-random*
(function).
ia
(reader method).
im
(reader method).
initialize-random-number-generator
(generic function).
internal-seed
(reader method).
iq
(reader method).
ir
(reader method).
iv
(reader method).
iy
(reader method).
ndiv
(reader method).
normal-random*
(function).
ntab
(reader method).
produce-random-bit-file
(function).
random-sample-with-range
(function).
rnmx
(reader method).
Packages are listed by definition order.
cl-variates
The variates package provides portable random number generation as well as numerous distributions.
variates
common-lisp
.
*probability-of-heads*
(special variable).
*random-generator*
(special variable).
basic-random-number-generator
(class).
binomial
(function).
exponential-random
(function).
flip
(function).
geometric
(function).
integer-random
(function).
make-random-number-generator
(function).
next-element
(generic function).
normal-random
(function).
ran1-random-number-generator
(class).
rand
(function).
random-boolean
(function).
random-element
(function).
random-number-generation-mixin
(class).
random-number-generator
(generic reader).
random-number-generator-class
(generic reader).
random-range
(function).
random-range-inclusive
(function).
random-seed
(generic function).
(setf random-seed)
(generic function).
ranq1-random-number-generator
(class).
sample-sequence
(function).
select-sample
(function).
shuffle-elements!
(generic function).
uniform-random
(function).
am
(generic reader).
current-value
(generic reader).
exponential-random*
(function).
ia
(generic reader).
im
(generic reader).
initialize-random-number-generator
(generic function).
internal-seed
(generic reader).
iq
(generic reader).
ir
(generic reader).
iv
(generic reader).
iy
(generic reader).
ndiv
(generic reader).
normal-random*
(function).
ntab
(generic reader).
produce-random-bit-file
(function).
random-sample-with-range
(function).
rnmx
(generic reader).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The default probably used in calls to flip (and therefore in calls to binomial and geometric).
This variable takes the place of CL’s *random-state*. It can be supplied as a generator to all the functions in the variates package.
Flip a coin (using flip) ‘n‘ times with probability ‘p‘ and return the number of heads.
Return a single element from the exponential distribution.
Flip a pseudo-random coin and return true if it comes up heads. The default probably of heads for the coin is *probability-of-heads*.
Returns a sample from the geometric distribution with probability ‘p‘. I.e., it returns the number of flips it takes until a possibly biased coin (using flip) comes up heads.
Returns a integer pseudo random number between low (inclusive) and high (inclusive).
Return a new random number generator of class ‘class’ using ‘seed’ as the initial seed.
Returns a normally distributed double-float pseudo random number with using ’mean’ and ’standard-deviation’.
Simple standin for Common Lisp random function. [[?? remove, just type more]]
Returns T with probability given. Defaults to 0.5d0.
Returns a element selected from sequence uniformly at random. Start and end can be supplied to select an element from a subsequence of sequence.
Returns a pseudo random number between low (inclusive) and high (exclusive or inclusive depending are arguments). If low and high are both integers (fixnums or bignums) this will return an integer, otherwise it will return a double-float.
Returns a pseudo random number between low and high (both inclusive). If low and high are both integers (fixnums or bignums) this will return an integer, otherwise it will return a double-float.
Returns a sub-sequence of ‘seq‘ with probability ‘pr‘ that each element of ‘seq‘ will be included. If a key function is supplied, then it is applied to each included element. [[?? Remove, use select-sample and/or sample-elements instead.]]
Returns a bit vector of size total-size with exactly sample-size
bits set to 1. The one bits are selected uniformly at random. The algorithm
is attributed to Robert Floyd by Jon Bentley in More Programming Pearls.
Returns a double-float pseudo random number between low (inclusive) and high (exclusive).
Returns the next pseudo random number from a random number generator (using the generator as output stream metaphor).
random-number-generation-mixin
)) ¶ranq1-random-number-generator
)) ¶ran1-random-number-generator
)) ¶random-number-generation-mixin
)) ¶automatically generated reader method
random-number-generation-mixin
)) ¶automatically generated reader method
Returns the original random seed of the generator.
random-number-generation-mixin
)) ¶basic-random-number-generator
)) ¶automatically generated reader method
Sets the random seed of the generator. Two random generators with of the same class with the same seed will return the same sequence of random numbers.
random-number-generation-mixin
)) ¶basic-random-number-generator
)) ¶Destructively rearrange the elements of a container by performing ’times’ swaps. If times is not specified, it will perform 2 times the container’s size swaps.
sequence
) &key generator times) ¶random-number-generation-mixin
) &key random-seed) ¶ranq1-random-number-generator
) &key) ¶ran1-random-number-generator
) &key) ¶Root superclass for all random number generators.
Initarg | Value |
---|---|
:random-seed | 42 |
:random-seed
This slot is read-only.
From Numerical Recipes in C:
’Minimal’ random number generator of Park and Miller with Bayes-Durham
shuffle and added safeguards. Returns a uniform random deviate between 0.0 and
1.0 (exclusive of the endpoint values). It has a period of 2^31 - 1
(~ 2.1 x 10^9)
am
.
ia
.
im
.
initialize-instance
.
initialize-random-number-generator
.
internal-seed
.
iq
.
ir
.
iv
.
iy
.
ndiv
.
next-element
.
ntab
.
rnmx
.
0.0d0
:internal-seed
This slot is read-only.
Mixing this class into another class will make it appear to be a random number generator. The new class can be used as a generator in the various random number routines, has a random seed and so on. The mixin also provides two initargs: random-seed and random-number-generator-class. The former is self-explanitory. The latter specifies which random number generator class to use.
Initarg | Value |
---|---|
:random-number-generator-class | (quote ran1-random-number-generator) |
:random-seed | 42 |
:random-number-generator
This slot is read-only.
:random-number-generator-class
This slot is read-only.
From Numerical Recipes in C:
This is a quick and dirty generator which ’is about as good as any 32-bit linear congruential generator. It is only about 1.7 times faster than ran1 because of the extra divide we need. It also conses about 1.7 times less. I believe it has the same period as ran1.
0.0d0
This slot is read-only.
Gets a single value sampled from the normal distribution with mean ‘mean’ and standard devation ‘standard-deviation.’ This uses the algorithm from Numerical Recipes in C.
ran1-random-number-generator
)) ¶automatically generated reader method
am
.
ranq1-random-number-generator
)) ¶automatically generated reader method
ran1-random-number-generator
)) ¶automatically generated reader method
ia
.
ran1-random-number-generator
)) ¶automatically generated reader method
im
.
(Internal) (Re)initialize a random number generator. Called when the generator is created and when the seed is changed.
ranq1-random-number-generator
)) ¶ran1-random-number-generator
)) ¶ran1-random-number-generator
)) ¶automatically generated reader method
ran1-random-number-generator
)) ¶automatically generated reader method
iq
.
ran1-random-number-generator
)) ¶automatically generated reader method
ir
.
ran1-random-number-generator
)) ¶automatically generated reader method
iv
.
ran1-random-number-generator
)) ¶automatically generated reader method
iy
.
ran1-random-number-generator
)) ¶automatically generated reader method
ndiv
.
ran1-random-number-generator
)) ¶automatically generated reader method
ntab
.
ran1-random-number-generator
)) ¶automatically generated reader method
rnmx
.
Jump to: | (
A B C E F G I M N P R S U |
---|
Jump to: | (
A B C E F G I M N P R S U |
---|
Jump to: | *
A C I N R S |
---|
Jump to: | *
A C I N R S |
---|
Jump to: | A B C D F I M P R S V W |
---|
Jump to: | A B C D F I M P R S V W |
---|