public class RandomGen
extends java.lang.Object
| Constructor and Description |
|---|
RandomGen()
Create a new random instance with a fixed seed value.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBoolean(int percent)
Get a boolean that is true with the given probability in percent.
|
byte[] |
getByteArray()
Get a random byte array.
|
void |
getBytes(byte[] data)
Get a number of random bytes.
|
int |
getInt(int max)
Get the next integer that is smaller than max.
|
int[] |
getIntArray()
Get a random integer array.
|
int |
getLog(int max)
Get the next random value that is at most max but probably much lower.
|
double |
getRandomDouble()
Get a random double.
|
int |
getRandomInt()
Get a random integer.
|
long |
getRandomLong()
Get a random long.
|
java.lang.String |
modify(java.lang.String sql)
Randomly modify a SQL statement.
|
boolean |
nextBoolean()
Get a random boolean.
|
double |
nextGaussian()
Get the next gaussian value.
|
java.sql.Date |
randomDate()
Get a random date value.
|
java.lang.String |
randomString(int len)
Get a random string with the given length.
|
java.sql.Time |
randomTime()
Get a random time value.
|
java.sql.Timestamp |
randomTimestamp()
Get a random timestamp value.
|
void |
setSeed(int seed)
Set the seed value.
|
public RandomGen()
public int getInt(int max)
max - the upper limit (exclusive)public double nextGaussian()
public int getLog(int max)
max - the maximum valuepublic void getBytes(byte[] data)
data - the target bufferpublic boolean getBoolean(int percent)
percent - the probabilitypublic java.lang.String randomString(int len)
len - the lengthpublic int getRandomInt()
public long getRandomLong()
public double getRandomDouble()
public boolean nextBoolean()
public int[] getIntArray()
public byte[] getByteArray()
public java.sql.Time randomTime()
public java.sql.Timestamp randomTimestamp()
public java.sql.Date randomDate()
public java.lang.String modify(java.lang.String sql)
sql - the original SQL statementpublic void setSeed(int seed)
seed - the new seed value