EchoPoint API - 3.0.0b5
App Webcontainer

echopoint.util
Class RandKit

java.lang.Object
  extended by echopoint.util.RandKit

public class RandKit
extends Object


Method Summary
static Calendar rand(Calendar start, Calendar end)
          Returns a new Calendar object which is between start and end
static double rand(double lo, double hi)
          get random numbers in a range, lo <= number <= hi
static int rand(int lo, int hi)
          get random numbers in a range, lo <= number <= hi
static long rand(long lo, long hi)
          get random numbers in a range, lo <= number <= hi
static Object[] rand(Object[] possibles, Object[] destination)
          This method will return a random sample of the possibles array into the destination array, without repeating any options.
static boolean roll(boolean[] booleans)
          Returns a random boolean from the array of booleans
static char roll(char[] chars)
          Returns a random char from the array of chars
static double roll(double[] doubles)
          Returns a random double from the array of doubles
static float roll(float[] floats)
          Returns a random float from the array of floats
static boolean roll(int percentageChance)
          Returns true "chance" percent of the time.
static int roll(int[] ints)
          Returns a random int from the array of ints
static Object roll(List list)
          Returns a random Object from the List of Objects
static long roll(long[] longs)
          Returns a random long from the array of longs
static Object roll(Object[] arr)
          Returns a random object from the array of objects
static String roll(String[] arrStrings)
          Returns a random String from the array of Strings
static boolean roll5050()
          Returns true of false 50 percent of the time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

rand

public static double rand(double lo,
                          double hi)
get random numbers in a range, lo <= number <= hi


rand

public static int rand(int lo,
                       int hi)
get random numbers in a range, lo <= number <= hi


rand

public static long rand(long lo,
                        long hi)
get random numbers in a range, lo <= number <= hi


rand

public static Calendar rand(Calendar start,
                            Calendar end)
Returns a new Calendar object which is between start and end


roll

public static char roll(char[] chars)
Returns a random char from the array of chars


roll

public static double roll(double[] doubles)
Returns a random double from the array of doubles


roll

public static float roll(float[] floats)
Returns a random float from the array of floats


roll

public static int roll(int[] ints)
Returns a random int from the array of ints


roll

public static long roll(long[] longs)
Returns a random long from the array of longs


roll

public static Object roll(Object[] arr)
Returns a random object from the array of objects


roll

public static String roll(String[] arrStrings)
Returns a random String from the array of Strings


roll

public static boolean roll(boolean[] booleans)
Returns a random boolean from the array of booleans


roll

public static boolean roll(int percentageChance)
Returns true "chance" percent of the time. Of course chance should be an integer between 0 and 100.


roll

public static Object roll(List list)
Returns a random Object from the List of Objects


roll5050

public static boolean roll5050()
Returns true of false 50 percent of the time


rand

public static Object[] rand(Object[] possibles,
                            Object[] destination)
This method will return a random sample of the possibles array into the destination array, without repeating any options. By providing a destination array, then the eact type of the returned array can be controlled.

Parameters:
possibles - - an array of possible choices
destination - - the destination array for random choices
Returns:
- the destination array itself

EchoPoint API - 3.0.0b5
App Webcontainer