Package | Description |
---|---|
squidpony.squidmath |
A very broad package containing random number generators, geometry tools, data structures, and noise functions.
|
Modifier and Type | Interface and Description |
---|---|
interface |
FlawedRandomness
An interface to indicate a
RandomnessSource that is intentionally flawed to create output patterns where a
truly random sequence would have none. |
interface |
IRNG
Interface for full-featured random number generators to implement (it does more than, and includes all of,
RandomnessSource ). |
interface |
IStatefulRNG
Simply groups the two interfaces
IRNG and StatefulRandomness so some implementations of IRNG can have
their states read from and written to. |
interface |
SkippingRandomness
A simple interface for RandomnessSources that have the additional capability to skip forward or backward in their
generated number stream.
|
interface |
StatefulRandomness
A simple interface for RandomnessSources that have the additional property of a state that can be re-set.
|
Modifier and Type | Class and Description |
---|---|
class |
AbstractRNG
A helper class for implementing
IRNG without so much busy-work. |
class |
BasicRandom32
A low-quality but very fast RNG that has no apparent visual artifacts here; uses Mark Overton's CMR subcycle
generator type, but modified to be especially GWT-friendly.
|
class |
BasicRandom64
A high-quality and very fast RNG that has no apparent visual artifacts here; uses Mark Overton's CMR subcycle
generator type, with a multiplication on the output.
|
class |
ChaosRNG
An RNG that cannot be seeded and should be fairly hard to predict what it will return next.
|
class |
CriticalRNG
A type of RNG that can generate values larger or smaller than the normal maximum or minimum, based on a modifier.
|
class |
DeckRNG
An RNG variant that has 16 possible grades of value it can produce and shuffles them like a deck of cards.
|
class |
DharmaRNG
An alteration to a RandomnessSource that attempts to produce values that are perceived as fair to an imperfect user.
|
class |
DistinctRNG
A StatefulRandomness with one
long state; calling DistinctRNG.nextLong() will produce every long exactly
once before repeating. |
class |
DistributedRNG
An implementation of
IRNG that allows specifying a distribution for all random numbers it produces via a
IDistribution.SimpleDistribution value. |
class |
DiverRNG
A very-high-quality StatefulRandomness that is the fastest 64-bit generator in this library that passes statistical
tests and is one-dimensionally equidistributed across all 64-bit outputs.
|
class |
EditRNG
A subclass of StatefulRNG (and thus RNG) that allows customizing many parts of the random number generation.
|
static class |
FlawedRandomness.AddRotate
A flawed randomness source that adds a rotation of its state, to its state, every generation.
|
static class |
FlawedRandomness.BigCounter
A flawed randomness source that depends almost entirely on its starting state for any random-seeming results in
its output.
|
class |
FourWheelRNG
A RandomnessSource with four
long states that changes its state with complex ways it can connect states to
other states. |
class |
GearRNG
A larger-period generator with 127 bits of state (two longs, one is always odd), a period of 2 to the 127, and what
should be slightly better speed than the related OrbitRNG.
|
class |
GoatRNG
A larger-period generator with 128 bits of state, good speed, and high quality in PractRand testing; it is at least
1-dimensionally equidistributed.
|
class |
GWTRNG
An IRNG implementation that is meant to provide random numbers very quickly when targeting GWT but also to produce
the same numbers when used on desktop, Android, or other platforms, and that can have its state read as a
StatefulRandomness.
|
class |
IsaacRNG
This is a port of the public domain Isaac64 (cryptographic) random number generator to Java.
|
class |
Lathe32RNG
A modification of Blackman and Vigna's xoroshiro128+ generator using two 32-bit ints of state instead of two 64-bit
longs, as well as modifying the output with two additional operations on the existing state; this is both the fastest
generator on GWT I have found without statistical failures, and a StatefulRandomness.
|
class |
LFSR
A Linear Feedback Shift Register that may be used like a StatefulRandomness but is not truly random.
|
class |
LightRNG
This is a SplittableRandom-style generator, meant to have a tiny state
that permits storing many different generators with low overhead.
|
class |
LinnormRNG
A mid-high-quality StatefulRandomness that is the second-fastest 64-bit generator in this library that is
1-dimensionally equidistributed across its 64-bit outputs.
|
class |
LongPeriodRNG
An RNG that has a drastically longer period than the other generators in SquidLib, other than
IsaacRNG ,
without sacrificing speed or GWT support. |
class |
MersenneTwister
Mersenne Twister, 64-bit version as a RandomnessSource.
|
class |
MiniMover64RNG
The fastest generator in this library on desktop JVMs; one of Mark Overton's subcycle generators from
this article, specifically a CMR with a 64-bit state, that has
its result multiplied by a constant.
|
class |
MizuchiRNG
A high-quality StatefulRandomness based on
LinnormRNG but modified to allow any odd number as a stream,
instead of LinnormRNG's hardcoded stream of 1. |
class |
MoonwalkRNG
An IRNG implementation that allows the extra functionality of a StatefulRandomness and a SkippingRandomness, as well
as allowing reverse-lookup of the state that produced a long using the static
MoonwalkRNG.inverseNextLong(long) method,
and distance checks between two generated numbers with the static MoonwalkRNG.distance(long, long) method. |
class |
Mover32RNG
One of Mark Overton's subcycle generators from this article,
specifically a cmr^cmr with two 32-bit states; this is the fastest 32-bit generator that still passes statistical
tests, plus it's optimized for GWT (sometimes).
|
class |
Mover64RNG
One of Mark Overton's subcycle generators from this article,
specifically a cmr^cmr with two 64-bit states.
|
class |
NLFSR
A Non-Linear Feedback Shift Register that may be used like a StatefulRandomness but is not truly random.
|
class |
OrbitRNG
A variant on
ThrustAltRNG that gives up some speed to gain a much better period and the ability to produce
all possible long values over that period. |
class |
Oriole32RNG
A modification of Blackman and Vigna's xoroshiro128+ generator using two 32-bit ints of state instead of two 64-bit
longs and also incorporating a large-increment counter (Weyl sequence) that is added to the rotated xoroshiro output;
this is tied with
Lathe32RNG for the fastest generator on GWT I have found that also passes the full 32TB
battery of PractRand's statistical tests. |
class |
PermutedRNG
This is a RandomnessSource in the PCG-Random family.
|
class |
PintRNG
A RandomnessSource based on PCG-Random that has a single int of state.
|
class |
PulleyRNG
A very-high-quality StatefulRandomness that is meant to be reasonably fast, but also to be robust against frequent
state changes, and is built around a strong determine() method.
|
class |
RNG
A wrapper class for working with random number generators in a more friendly way.
|
class |
RomuTrioRNG
A well-studied RNG that can be quite fast in some circumstances.
|
class |
SilkRNG
An IStatefulRNG implementation that is meant to provide random numbers very quickly when targeting GWT but also to
produce the same numbers when used on desktop, Android, or other platforms, and that can have its state read as a
StatefulRandomness; it is thus like
GWTRNG but should perform better on recent desktop JVMs. |
class |
SobolQRNG
Implementation of a Sobol sequence as a Quasi-Random Number Generator.
|
class |
SpecifiedRandomness
A specialized StatefulRandomness that produces a pre-determined sequence of results as
SpecifiedRandomness.nextLong()
and/or SpecifiedRandomness.next(int) are called. |
class |
Starfish32RNG
A modification of Blackman and Vigna's xoroshiro64** generator; uses two 32-bit ints of state like
Lathe32RNG
but has better equidistribution. |
class |
StatefulRNG
A slight variant on RNG that always uses a stateful RandomessSource and so can have its state
set or retrieved using setState() or getState().
|
class |
StrangerRNG
A RandomnessSource with four
long states that changes its state with complex ways it can connect states to
other states. |
class |
TangleRNG
A very fast generator on 64-bit systems that allows choosing any of 2 to the 63 odd-number streams.
|
class |
ThrustAltRNG
A random number generator that is extremely fast but can't return all possible results.
|
class |
TricycleRNG
A RandomnessSource with three
long states that changes its state with three ways it can connect states to
other states. |
class |
TrimRNG
A RandomnessSource with four
long states; one is a simple counter, and the rest mix and match all four states
to get their next value. |
class |
TweakRNG
Somewhat experimental RNG that can be configured to smoothly transition between producing mostly values in the
center of its range, to producing more values at or near the extremes, as well as favoring high or low results.
|
class |
VanDerCorputQRNG
A quasi-random number generator that goes through one of many sub-random sequences found by J.G.
|
class |
WhiskerRNG
A RandomnessSource with four
long states performs very few operations per random number, and can often
perform those operations as instruction-parallel. |
class |
XoRoRNG
A port of Blackman and Vigna's xoroshiro128+ generator; should be very fast and produce medium-quality output.
|
class |
XoshiroStarPhi32RNG
A modification of Blackman and Vigna's xoshiro128 generator with a different "scrambler" than the default; this
generator has four 32-bit states and passes at least 32TB of PractRand (with one "unusual" anomaly at 4TB).
|
class |
XoshiroStarStar64RNG
A random number generator that is fairly fast and guarantees 4-dimensional equidistribution (with the exception of the
quartet with four zeroes in a row, every quartet of long results is produced exactly once over the period).
|
Modifier and Type | Field and Description |
---|---|
protected RandomnessSource |
RNG.random |
Modifier and Type | Method and Description |
---|---|
RandomnessSource |
RandomnessSource.copy()
Produces a copy of this RandomnessSource that, if next() and/or nextLong() are called on this object and the
copy, both will generate the same sequence of random numbers from the point copy() was called.
|
RandomnessSource |
StatefulRandomness.copy()
Produces a copy of this StatefulRandomness that, if next() and/or nextLong() are called on this object and the
copy, both will generate the same sequence of random numbers from the point copy() was called.
|
RandomnessSource |
DeckRNG.getRandomness() |
RandomnessSource |
DharmaRNG.getRandomness() |
RandomnessSource |
EditRNG.getRandomness() |
RandomnessSource |
RNG.getRandomness() |
Modifier and Type | Method and Description |
---|---|
static long |
GreasedRegion.approximateBits(RandomnessSource random,
int bitCount)
Generates a random 64-bit long with a number of '1' bits (Hamming weight) equal on average to bitCount.
|
GreasedRegion |
GreasedRegion.deteriorate(RandomnessSource random,
double preservation)
Randomly removes points from a GreasedRegion, with preservation as a fraction between 1.0 (keep all) and 0.0
(remove all).
|
GreasedRegion |
GreasedRegion.deteriorate(RandomnessSource rng,
int preservation)
Randomly removes points from a GreasedRegion, with larger values for preservation keeping more of the existing
shape intact.
|
GreasedRegion |
GreasedRegion.disperseRandom(RandomnessSource random)
Removes "on" cells that are nearby other "on" cells, with a random factor to which bits are actually turned off
that still ensures exactly half of the bits are kept as-is (the one exception is when height is an odd number,
which makes the bottom row slightly random).
|
GreasedRegion |
GreasedRegion.fray(RandomnessSource random,
double fractionKept)
Like
GreasedRegion.retract() , this removes the "on" cells that are 4-way-adjacent to any "off" cell, but unlike that
method it keeps a fraction of those surface cells, randomly selecting them. |
static long |
GreasedRegion.randomInterleave(RandomnessSource random)
Gets a somewhat-random long with exactly 32 bits set; in each pair of bits starting at bit 0 and bit 1, then bit
2 and bit 3, up to bit 62 and bit 3, one bit will be 1 and one bit will be 0 in each pair.
|
GreasedRegion |
GreasedRegion.refill(RandomnessSource random,
double fraction,
int width,
int height)
Reassigns this GreasedRegion randomly, reusing the current data storage (without extra allocations) if this.width
== width and this.height == height, while trying to set the given fraction of cells to on.
|
GreasedRegion |
GreasedRegion.refill(RandomnessSource random,
int width,
int height)
Reassigns this GreasedRegion by filling it with random values from random, reusing the current data storage
(without extra allocations) if this.width == width and this.height == height, and typically assigning
approximately half of the cells in this to "on" and the rest to off.
|
void |
DeckRNG.setRandomness(RandomnessSource random)
Reseeds this DeckRNG using the RandomnessSource it is given.
|
void |
DharmaRNG.setRandomness(RandomnessSource random) |
void |
EditRNG.setRandomness(RandomnessSource random) |
void |
RNG.setRandomness(RandomnessSource random) |
void |
StatefulRNG.setRandomness(RandomnessSource random) |
Constructor and Description |
---|
CriticalRNG(RandomnessSource random)
Makes a CriticalRNG with a luck factor of 0 and the given RandomnessSource.
|
CriticalRNG(RandomnessSource random,
float luck)
Makes a CriticalRNG with a luck factor of 0 and the given RandomnessSource.
|
CustomRandom(RandomnessSource randomnessSource)
Creates a new random number generator.
|
DeckRNG(RandomnessSource random)
Seeds this DeckRNG using the RandomnessSource it is given.
|
DharmaRNG(RandomnessSource rs)
Construct a new DharmaRNG with the given seed.
|
DharmaRNG(RandomnessSource rs,
double fairness)
Construct a new DharmaRNG with the given seed.
|
EditRNG(RandomnessSource rs)
Construct a new EditRNG with the given seed.
|
EditRNG(RandomnessSource rs,
double expected)
Construct a new EditRNG with the given seed.
|
EditRNG(RandomnessSource rs,
double expected,
double centrality)
Construct a new EditRNG with the given seed.
|
GapShuffler(java.util.Collection<T> items,
RandomnessSource rng)
Constructor that takes any Collection of T, shuffles it with the given RNG, and can then iterate infinitely
through mostly-random shuffles of the given collection.
|
GapShuffler(T[] items,
RandomnessSource rng)
Constructor that takes any Collection of T, shuffles it with the given RNG, and can then iterate infinitely
through mostly-random shuffles of the given collection.
|
GreasedRegion(RandomnessSource random,
double fraction,
int width,
int height)
Constructor for a random GreasedRegion of the given width and height, trying to set the given fraction of cells
to on.
|
GreasedRegion(RandomnessSource random,
int width,
int height)
Constructor for a random GreasedRegion of the given width and height, typically assigning approximately half of
the cells in this to "on" and the rest to off.
|
ProbabilityTable(RandomnessSource rng)
Creates a new probability table with the provided source of randomness
used.
|
RNG(RandomnessSource random)
Uses the provided source of randomness for all calculations.
|
StatefulRNG(RandomnessSource random) |
Copyright © Eben Howard 2012–2022. All rights reserved.