flip
public static boolean flip()
Returns true or false randomly with equal probability.
- true or false randomly with equal probability.
flip
public static boolean flip(double p)
Returns true randomly with the probability p.
p - A probability for returning true
getRandom
public static ArrayList getRandom(ArrayList al,
Class c)
throws InstantiationException,
IllegalAccessException Returns a populated ArrayList of random length. If the class of the
object contained into the vector implements CastorTestable,
randomizeFields() will be called on the objects.
al - the ArrayList to populatec - the type of object to put in the vector
- a populated ArrayList of random length.
getRandom
public static BigDecimal getRandom(BigDecimal bg,
Class c) Returns a random BigDecimal.
bg - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
getRandom
public static Collection getRandom(Collection al,
Class c)
throws InstantiationException,
IllegalAccessException Returns a populated Collection of random length. If the class of the
object contained into the vector implements CastorTestable,
randomizeFields() will be called on the objects.
al - the ArrayList to populatec - the type of object to put in the vector
- a populated ArrayList of random length.
getRandom
public static List getRandom(List al,
Class c)
throws InstantiationException,
IllegalAccessException Returns a populated List of random length. If the class of the object
contained into the vector implements CastorTestable, randomizeFields()
will be called on the objects.
al - the ArrayList to populatec - the type of object to put in the vector
- a populated ArrayList of random length.
getRandom
public static Object getRandom(Object object,
Class c) Returns a random Object of the type provided by class c.
object - An unused parameter, used only for polymorphism.c - the type of object we will create a randomized instance of. This
class must implement CastorTestable.
getRandom
public static Object[] getRandom(Object[] array,
Class c)
throws InstantiationException,
IllegalAccessException Creates a populated array of type c of random length. If the class to put
into the vector implements CastorTestable, randomizeFields() will be
called on the objects.
array - An unused parameter, used only for polymorphism.c - the type of object to put in the array
- a populated array of random length.
getRandom
public static Set getRandom(Set al,
Class c)
throws InstantiationException,
IllegalAccessException Returns a populated Set of random length. If the class of the object
contained into the vector implements CastorTestable, randomizeFields()
will be called on the objects.
al - the Set to populatec - the type of object to put in the vector
- a populated Set of random length.
getRandom
public static SortedSet getRandom(SortedSet al,
Class c)
throws InstantiationException,
IllegalAccessException Returns a populated SortedSet of random length. If the class of the
object contained into the vector implements CastorTestable,
randomizeFields() will be called on the objects.
al - the SortedSet to populatec - the type of object to put in the vector
- a populated SortedSet of random length.
getRandom
public static String getRandom(String s,
Class c) Returns a random String that will not have leading or trailing whitespace
and that will not have consecutive internal whitespace. To get a random
string without these restrictions, use
getRandom(String,Class,boolean) with the boolean argument
false.
s - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
getRandom
public static String getRandom(String s,
Class c,
boolean collapseWhitespace) Returns a random String, optionally with leading and trailing whitespace
removed and internal consecutive whitespace collapsed.
s - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitivecollapseWhitespace - if true, removes leading and trailing
whitespace and collapses multiple consecutive spaces.
getRandom
public static String[] getRandom(String[] array,
Class c) Returns a populated array of String of random length.
array - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
- a populated array of String of random length.
getRandom
public static Vector getRandom(Vector vect,
Class c)
throws InstantiationException,
IllegalAccessException Returns a populated vector of random length. If the class to put into the
vector implements CastorTestable, randomizeFields() will be called on the
objects.
vect - the vector to populate, if null a new Vector will be created.c - the type of object to put in the vector.
- a populated Vector of random length.
getRandom
public static boolean getRandom(boolean b)
Returns a random boolean.
b - An unused parameter, used only for polymorphism.
getRandom
public static byte getRandom(byte b)
Returns a random byte.
b - An unused parameter, used only for polymorphism.
getRandom
public static byte[] getRandom(byte[] array,
Class c) Returns a populated array of byte of random length.
array - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
- a populated array of byte of random length.
getRandom
public static char getRandom(char c)
Returns a random printable char.
c - An unused parameter, used only for polymorphism.
getRandom
public static double getRandom(double d)
Returns a random double.
d - An unused parameter, used only for polymorphism.
getRandom
public static float getRandom(float f)
Returns a random float.
f - An unused parameter, used only for polymorphism.
getRandom
public static int getRandom(int i)
Returns a random int.
i - An unused parameter, used only for polymorphism.
getRandom
public static int[] getRandom(int[] array,
Class c) Returns a populated array of int of random length.
array - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
- a populated array of int of random length.
getRandom
public static java.util.Date getRandom(java.util.Date date,
Class c) Returns a random java.util.Date.
date - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
getRandom
public static long getRandom(long l)
Returns a random long.
l - An unused parameter, used only for polymorphism.
getRandom
public static RecurringDuration getRandom(RecurringDuration recurring,
Class c) Returns a random Castor RecurringDuration.
recurring - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
- a random Castor recurringDuration.
getRandom
public static TimeDuration getRandom(TimeDuration date,
Class c) Returns a random Castor TimeDuration.
date - An unused parameter, used only for polymorphism.c - An unused parameter that indicates we are making a random
Object, not a random primitive
- a random Castor timeDuration.
getSeed
public static long getSeed()
Returns the seed which was used to initialize the pseudo-random number
generator.
- the seed which was used to initialize the pseudo-random number
generator
rndPrintableChar
public static char rndPrintableChar()
- a random printable character from the PRINTABLE_CHAR string.
setSeed
public static void setSeed(long seed)
Re-initializes the random number generator with the given seed.
seed - the new seed for the random number generator.