This class provides the API for creating generators of random numbers.
This package provides
by which low-level classes implemented in module "commons-rng-core"
Classes in package
should not be used directly.
The generators are not thread-safe: Parallel applications must use different generator instances in different threads.
In the case of pseudo-random generators, the source of randomness is
usually a set of numbers whose bits representation are scrambled in such
a way as to produce a random-looking sequence.
The main property of the sequence is that the numbers must be uniformly distributed within their allowed range.
Classes in this package do not provide any further processing of the number generation such as to match other types of distribution.
Which source of randomness to choose may depend on which properties
are more important.
Considerations can include speed of generation, memory usage, period
size, equidistribution, correlation, etc.
For some of the generators, interesting properties (of the reference implementations) are proven in scientific papers. Some generators can also suffer from potential weaknesses.
For simple sampling, any of the generators implemented in this library
may be sufficient.
For Monte-Carlo simulations that require generating high-dimensional vectors), equidistribution and non-correlation are crucial. The Mersenne Twister and Well generators have equidistribution properties proven according to their bits pool size which is directly related to their period (all of them have maximal period, i.e. a generator with size
n pool has a period
They also have equidistribution properties for 32 bits blocks up to
s/32 dimension where
s is their pool size.
Well19937c is equidistributed up to dimension 623
(i.e. 19937 divided by 32).
It means that a Monte-Carlo simulation generating vectors of
(32-bits integer) variables at each iteration has some guarantee on the
properties of its components as long as
n < 623.
Note that if the variables are of type
double, the limit is
divided by two (since 64 bits are needed to create a
Reference to the relevant publications are listed in the specific documentation of each class.
Memory usage can vary a lot between providers.
The state of
MersenneTwister is composed of 624 integers,
using about 2.5 kB.
The Well generators use 6 integer arrays, the length of each
being equal to the pool size; thus, for example,
uses about 33 kB.
Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.