public class GsRandom
extends java.util.Random
implements java.io.Serializable
Math.random(),
Random,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
ourString
ourString is a privately held instance of a String with
with some junk characters
|
| Constructor and Description |
|---|
GsRandom()
Creates a new random number generator.
|
GsRandom(long seed)
Creates a new random number generator using a single
long seed. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
nextBoolean()
Returns the next pseudorandom, uniformly distributed
boolean
value from this random number generator's sequence |
byte |
nextByte()
Returns the next pseudorandom, uniformly distributed
byte
value from this random number generator's sequence |
char |
nextChar()
Returns the next pseudorandom, uniformly distributed
char
value from this random number generator's sequence
There is a hack here to prevent '}' so as to eliminate the possiblity
of generating a sequence which would falsely get marked as a suspect
string while we are matching the pattern {[0-9]+}. |
java.util.Date |
nextDate()
Returns a random Date.
|
double |
nextDouble(double max)
Returns the next pseudorandom, uniformly distributed
double
value from this random number generator's sequence within a range
from 0 to max. |
double |
nextDouble(double min,
double max)
Returns the next pseudorandom, uniformly distributed
double
value from this random number generator's sequence within a range
from min to max. |
int |
nextInt(int max)
Returns the next pseudorandom, uniformly distributed
int
value from this random number generator's sequence within a range
from 0 to max (inclusive -- which is different from Random.nextInt()). |
int |
nextInt(int min,
int max)
Returns the next pseudorandom, uniformly distributed
int
value from this random number generator's sequence within a range
from min to max. |
long |
nextLong(long max)
Returns the next pseudorandom, uniformly distributed
long
value from this random number generator's sequence within a range
from 0 to max. |
long |
nextLong(long min,
long max)
Returns the next pseudorandom, uniformly distributed
long
value from this random number generator's sequence within a range
from min to max. |
short |
nextShort() |
java.lang.Object |
randomElement(java.util.Vector vec)
Returns a randomly-selected element of Vector vec.
|
java.lang.String |
randomReadableString(int max)
Like randomString(), but returns only readable characters.
|
java.lang.String |
randomString()
Returns a random subset of a pregenerated string.
|
java.lang.String |
randomString(int max)
Returns a bounded random subset of a pregenerated large
string.
|
protected static java.lang.String ourString
public GsRandom()
System.currentTimeMillis(),
Random.Random()public GsRandom(long seed)
long seed.seed - the initial seed.Random.Random(long)public boolean nextBoolean()
boolean
value from this random number generator's sequencenextBoolean in class java.util.Randomboolean
value from this random number generator's sequence.public char nextChar()
char
value from this random number generator's sequence
There is a hack here to prevent '}' so as to eliminate the possiblity
of generating a sequence which would falsely get marked as a suspect
string while we are matching the pattern {[0-9]+}.
https://svn.gemstone.com/trac/gemfire/ticket/40415char
value from this random number generator's sequence.public byte nextByte()
byte
value from this random number generator's sequencebyte
value from this random number generator's sequence.public double nextDouble(double max)
double
value from this random number generator's sequence within a range
from 0 to max.max - the maximum range (inclusive) for the pseudorandom.double
value from this random number generator's sequence.public double nextDouble(double min,
double max)
double
value from this random number generator's sequence within a range
from min to max.min - the minimum range (inclusive) for the pseudorandom.max - the maximum range (inclusive) for the pseudorandom.double
value from this random number generator's sequence.public short nextShort()
public long nextLong(long max)
long
value from this random number generator's sequence within a range
from 0 to max.max - the maximum range (inclusive) for the pseudorandom.long
value from this random number generator's sequence.public long nextLong(long min,
long max)
long
value from this random number generator's sequence within a range
from min to max.min - the minimum range (inclusive) for the pseudorandom.max - the maximum range (inclusive) for the pseudorandom.long
value from this random number generator's sequence.public int nextInt(int max)
int
value from this random number generator's sequence within a range
from 0 to max (inclusive -- which is different from Random.nextInt()).nextInt in class java.util.Randommax - the maximum range (inclusive) for the pseudorandom.int
value from this random number generator's sequence.public int nextInt(int min,
int max)
int
value from this random number generator's sequence within a range
from min to max.
If max < min, returns 0 .min - the minimum range (inclusive) for the pseudorandom.max - the maximum range (inclusive) for the pseudorandom.int
value from this random number generator's sequence.public java.util.Date nextDate()
public java.lang.Object randomElement(java.util.Vector vec)
public java.lang.String randomString()
public java.lang.String randomString(int max)
max - the maximum length of the random string to generate.public java.lang.String randomReadableString(int max)