public class JavaRNG
extends java.lang.Object
implements squidpony.squidmath.RandomnessSource, java.io.Serializable
nextDouble() per cell).| Modifier and Type | Field and Description |
|---|---|
java.util.Random |
random |
| Constructor and Description |
|---|
JavaRNG()
Creates a new generator seeded using Math.random.
|
JavaRNG(long seed) |
JavaRNG(java.util.Random random) |
| Modifier and Type | Method and Description |
|---|---|
JavaRNG |
copy() |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
int |
next(int bits) |
boolean |
nextBoolean()
Gets a random value, true or false.
|
void |
nextBytes(byte[] bytes)
Given a byte array as a parameter, this will fill the array with random bytes (modifying it
in-place).
|
double |
nextDouble() |
double |
nextDouble(double outer) |
float |
nextFloat()
Gets a uniform random float in the range [0.0,1.0)
|
int |
nextInt() |
int |
nextInt(int bound) |
int |
nextInt(int lower,
int upper)
Inclusive lower, exclusive upper.
|
long |
nextLong() |
java.lang.String |
toString() |
public JavaRNG()
public JavaRNG(long seed)
public JavaRNG(java.util.Random random)
public int next(int bits)
next in interface squidpony.squidmath.RandomnessSourcepublic long nextLong()
nextLong in interface squidpony.squidmath.RandomnessSourcepublic JavaRNG copy()
copy in interface squidpony.squidmath.RandomnessSourcepublic int nextInt()
public int nextInt(int bound)
public int nextInt(int lower,
int upper)
lower - the lower bound, inclusive, can be positive or negativeupper - the upper bound, exclusive, should be positive, must be greater than lowerpublic double nextDouble()
public double nextDouble(double outer)
public float nextFloat()
public boolean nextBoolean()
public void nextBytes(byte[] bytes)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © Eben Howard 2012–2022. All rights reserved.