L64X256MixRandom implements
interfaces RandomGenerator and SplittableGenerator,
and therefore supports methods for producing pseudorandomly chosen
values of type int, long, float, double,
and boolean (and for producing streams of pseudorandomly chosen
numbers of type int, long, and double),
as well as methods for creating new split-off L64X256MixRandom
objects or streams of such objects.
The L64X256MixRandom algorithm is a specific member of
the LXM family of algorithms for pseudorandom number generators;
for more information, see the documentation for package
jdk.. Each instance of L64X256MixRandom
has 320 bits of state plus one 64-bit instance-specific parameter.
If two instances of L64X256MixRandom are created with
the same seed within the same program execution, and the same
sequence of method calls is made for each, they will generate and
return identical sequences of values.
As with java., instances of
L64X256MixRandom are not thread-safe. They are
designed to be split, not shared, across threads (see the split
method). For example, a java.
fork/join-style computation using random numbers might include a
construction of the form
new Subtask(someL64X256MixRandom.split()).fork().
This class provides additional methods for generating random
streams, that employ the above techniques when used in
stream.parallel() mode.
Instances of L64X256MixRandom are not cryptographically
secure. Consider instead using java.
in security-sensitive applications. Additionally,
default-constructed instances do not use a cryptographically random
seed unless the system property
java.util.secureRandomSeed is set to true.
| Modifier and Type | Field and Description |
|---|---|
| private final long | a
The parameter that is used as an additive constant for the LCG. |
| private static final AtomicLong | defaultGen
The seed generator for default constructors. |
| private static final long | |
| private long | s
The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. |
| private long | x0
The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. |
| private long | x1
The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. |
| private long | x2
The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. |
| private long | x3
The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. |
| Access | Constructor and Description |
|---|---|
| public | L64X256MixRandom(long
additive parameter for the LCG a, long initial state for the LCG s, long first word of the initial state for the XBG x0, long second word of the initial state for the XBG x1, long third word of the initial state for the XBG x2, long fourth word of the initial state for the XBG x3)Basic constructor that initializes all fields from parameters. |
| public | L64X256MixRandom(long
the initial seed seed)Creates a new instance of |
| public | L64X256MixRandom()
Creates a new instance of |
| public | L64X256MixRandom(byte[]
the initial seed seed)Creates a new instance of |
| Modifier and Type | Method and Description |
|---|---|
| public long | nextLong()
Implements java. Returns a pseudorandomly chosen |
| public RandomGenerator. | split(RandomGenerator.
Implements abstract jdk.
|
| a | back to summary |
|---|---|
| private final long a The parameter that is used as an additive constant for the LCG. Must be odd. | |
| defaultGen | back to summary |
|---|---|
| private static final AtomicLong defaultGen The seed generator for default constructors. | |
| M | back to summary |
|---|---|
| private static final long M | |
| s | back to summary |
|---|---|
| private long s The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. At least one of the four fields x0, x1, x2, and x3 must be nonzero. | |
| x0 | back to summary |
|---|---|
| private long x0 The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. At least one of the four fields x0, x1, x2, and x3 must be nonzero. | |
| x1 | back to summary |
|---|---|
| private long x1 The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. At least one of the four fields x0, x1, x2, and x3 must be nonzero. | |
| x2 | back to summary |
|---|---|
| private long x2 The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. At least one of the four fields x0, x1, x2, and x3 must be nonzero. | |
| x3 | back to summary |
|---|---|
| private long x3 The per-instance state: s for the LCG; x0, x1, x2, and x3 for the XBG. At least one of the four fields x0, x1, x2, and x3 must be nonzero. | |
| L64X256MixRandom | back to summary |
|---|---|
| public L64X256MixRandom(long a, long s, long x0, long x1, long x2, long x3) Basic constructor that initializes all fields from parameters. It then adjusts the field values if necessary to ensure that all constraints on the values of fields are met.
| |
| L64X256MixRandom | back to summary |
|---|---|
| public L64X256MixRandom(long seed) Creates a new instance of
| |
| L64X256MixRandom | back to summary |
|---|---|
| public L64X256MixRandom() Creates a new instance of | |
| L64X256MixRandom | back to summary |
|---|---|
| public L64X256MixRandom(byte[] seed) Creates a new instance of
| |
| nextLong | back to summary |
|---|---|
| public long nextLong() Implements java. Doc from java. Returns a pseudorandomly chosen
| |
| split | back to summary |
|---|---|
| public RandomGenerator. Implements abstract jdk.
| |