Liking cljdoc? Tell your friends :D

mersenne-twister.core

This namespace provides a Clojure-friendly wrapper around the MersenneTwister class from The Apache Commons Mathematics Library:

http://commons.apache.org/proper/commons-math/

This class implements a powerful pseudo-random number generator developed by Makoto Matsumoto and Takuji Nishimura during 1996-1997.

This generator features an extremely long period (219937-1) and 623-dimensional equidistribution up to 32 bits accuracy. The home page for this generator is located at:

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html

This generator is described in a paper by Makoto Matsumoto and Takuji Nishimura in 1998: Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3--30

This namespace provides a Clojure-friendly wrapper around the MersenneTwister
class from The Apache Commons Mathematics Library:

http://commons.apache.org/proper/commons-math/

This class implements a powerful pseudo-random number generator developed by
Makoto Matsumoto and Takuji Nishimura during 1996-1997.

This generator features an extremely long period (219937-1) and
623-dimensional equidistribution up to 32 bits accuracy. The home page for
this generator is located at:

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html

This generator is described in a paper by Makoto Matsumoto and Takuji
Nishimura in 1998: Mersenne Twister: A 623-Dimensionally Equidistributed
Uniform Pseudo-Random Number Generator, ACM Transactions on Modeling and
Computer Simulation, Vol. 8, No. 1, January 1998, pp 3--30
raw docstring

generatorclj

Default generator to use if none is specified.

Default generator to use if none is specified.
sourceraw docstring

lazy-booleansclj

(lazy-booleans)
(lazy-booleans generator)

Returns a lazy sequence of pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

Returns a lazy sequence of pseudorandom, uniformly distributed boolean value
from this random number generator's sequence.
sourceraw docstring

lazy-doublesclj

(lazy-doubles)
(lazy-doubles generator)

Returns a lazy sequence of pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

Returns a lazy sequence of pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.
sourceraw docstring

lazy-floatsclj

(lazy-floats)
(lazy-floats generator)

Returns a lazy sequence of pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

Returns a lazy sequence of pseudorandom, uniformly distributed float value
between 0.0 and 1.0 from this random number generator's sequence.
sourceraw docstring

lazy-gaussiansclj

(lazy-gaussians)
(lazy-gaussians generator)

Returns a lazy sequence of pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

Returns a lazy sequence of pseudorandom, Gaussian ("normally") distributed
double value with mean 0.0 and standard deviation 1.0 from this random number
generator's sequence.
sourceraw docstring

lazy-intsclj

(lazy-ints)
(lazy-ints thing)
(lazy-ints generator n)

Returns a lazy sequence of pseudorandom, uniformly distributed int value from this random number generator's sequence. All 232 possible int values should be produced with (approximately) equal probability.

This optionally takes a value n, such that it returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

When n is specified:

  • If n is a power of 2, this method returns (int) ((n * (long) next(31)) >> 31).

  • If n is not a power of 2, what is returned is next(31) % n with next(31) values rejected (i.e. regenerated) until a value that is larger than the remainder of Integer.MAX_VALUE / n is generated. Rejection of this initial segment is necessary to ensure a uniform distribution.

Returns a lazy sequence of pseudorandom, uniformly distributed int value from
this random number generator's sequence. All 232 possible int values should be
produced with (approximately) equal probability.

This optionally takes a value `n`, such that it returns a pseudorandom,
uniformly distributed int value between 0 (inclusive) and the specified
value (exclusive), drawn from this random number generator's sequence.

When `n` is specified:

 * If n is a power of 2, this method returns (int) ((n * (long) next(31)) >> 31).

 * If n is not a power of 2, what is returned is next(31) % n with next(31)
   values rejected (i.e. regenerated) until a value that is larger than the
   remainder of Integer.MAX_VALUE / n is generated. Rejection of this initial
   segment is necessary to ensure a uniform distribution.
sourceraw docstring

lazy-longsclj

(lazy-longs)
(lazy-longs thing)
(lazy-longs generator n)

Returns a lazy sequence of pseudorandom, uniformly distributed long value from this random number generator's sequence. All 264 possible long values should be produced with (approximately) equal probability.

This optionally takes a value n, such that it returns a pseudorandom, uniformly distributed long value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

Returns a lazy sequence of pseudorandom, uniformly distributed long value from
this random number generator's sequence. All 264 possible long values should
be produced with (approximately) equal probability.


This optionally takes a value `n`, such that it returns a pseudorandom,
uniformly distributed long value between 0 (inclusive) and the specified
value (exclusive), drawn from this random number generator's sequence. 
sourceraw docstring

new-generatorclj

(new-generator)
(new-generator seed)

Creates a new Mersenne Twister random number generator.

The instance is initialized using the current time plus the system identity hash code of this instance as the seed if no seed is specified.

Creates a new Mersenne Twister random number generator.

The instance is initialized using the current time plus the system identity
hash code of this instance as the seed if no seed is specified.
sourceraw docstring

next-booleanclj

(next-boolean)
(next-boolean generator)

Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed boolean value from this
random number generator's sequence.
sourceraw docstring

next-doubleclj

(next-double)
(next-double generator)

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed double value between 0.0
and 1.0 from this random number generator's sequence.
sourceraw docstring

next-floatclj

(next-float)
(next-float generator)

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed float value between 0.0
and 1.0 from this random number generator's sequence.
sourceraw docstring

next-gaussianclj

(next-gaussian)
(next-gaussian generator)

Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

Returns the next pseudorandom, Gaussian ("normally") distributed double value
with mean 0.0 and standard deviation 1.0 from this random number generator's
sequence.
sourceraw docstring

next-intclj

(next-int)
(next-int thing)
(next-int generator n)

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence. All 232 possible int values should be produced with (approximately) equal probability.

This optionally takes a value n, such that it returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

When n is specified:

  • If n is a power of 2, this method returns (int) ((n * (long) next(31)) >> 31).

  • If n is not a power of 2, what is returned is next(31) % n with next(31) values rejected (i.e. regenerated) until a value that is larger than the remainder of Integer.MAX_VALUE / n is generated. Rejection of this initial segment is necessary to ensure a uniform distribution.

Returns the next pseudorandom, uniformly distributed int value from this
random number generator's sequence. All 232 possible int values should be
produced with (approximately) equal probability.

This optionally takes a value `n`, such that it returns a pseudorandom,
uniformly distributed int value between 0 (inclusive) and the specified
value (exclusive), drawn from this random number generator's sequence.

When `n` is specified:

 * If n is a power of 2, this method returns (int) ((n * (long) next(31)) >> 31).

 * If n is not a power of 2, what is returned is next(31) % n with next(31)
   values rejected (i.e. regenerated) until a value that is larger than the
   remainder of Integer.MAX_VALUE / n is generated. Rejection of this initial
   segment is necessary to ensure a uniform distribution.
sourceraw docstring

next-longclj

(next-long)
(next-long thing)
(next-long generator n)

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence. All 264 possible long values should be produced with (approximately) equal probability.

This optionally takes a value n, such that it returns a pseudorandom, uniformly distributed long value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

Returns the next pseudorandom, uniformly distributed long value from this
random number generator's sequence. All 264 possible long values should be
produced with (approximately) equal probability.


This optionally takes a value `n`, such that it returns a pseudorandom,
uniformly distributed long value between 0 (inclusive) and the specified
value (exclusive), drawn from this random number generator's sequence.
sourceraw docstring

set-seed!clj

(set-seed! seed)
(set-seed! generator seed)

Reinitialize the generator as if just built with the given seed.

Reinitialize the generator as if just built with the given seed.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close