utilities
Class Random

java.lang.Object
  extended by utilities.Random

public class Random
extends Object

A class that contains many useful methods for finding random values of different classes.

Author:
Michael Kozelsky Created on: Jul 27, 2006 Random.java

Constructor Summary
Random()
           
 
Method Summary
static Color randomColor()
          Creates a random color
static Dimension randomDimension()
          Creates a random dimension where the height and width are between the values MINIMUM_DIMENSION and MAXIMUM_DIMENSION (inclusive).
static Dimension randomDimension(Integer low, Integer high)
          Creates a random dimension where the height and width are between the given values (inclusive).
static Integer randomInteger(Integer low, Integer high)
          Picks a random number between low and high (inclusive)
static Point randomPoint()
          Creates a random dimension where the x and y coordinate are between the values MINIMUM_XY and MAXIMUM_XY (inclusive).
static Point randomPoint(Integer low, Integer high)
          Creates a random point where the x and y coordinates are between the given values (inclusive).
static Point randomPoint(Integer lowX, Integer highX, Integer lowY, Integer highY)
          Creates a random point where the x and y coordinates are between the given values (inclusive).
static SineMaker randomSineMaker()
          Creates a random SineMaker
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Random

public Random()
Method Detail

randomColor

public static Color randomColor()
Creates a random color

Returns:
a random graphics.colors.Color

randomInteger

public static Integer randomInteger(Integer low,
                                    Integer high)
Picks a random number between low and high (inclusive)

Parameters:
low - the low bound of the random number
high - the high bound of the random number
Returns:
a random number inbetween the given values (inclusive)

randomDimension

public static Dimension randomDimension(Integer low,
                                        Integer high)
Creates a random dimension where the height and width are between the given values (inclusive). The width and height are determined separately - meaning this will not always return a dimension where the width and height are the same.

Parameters:
low - the low bound of the width and height value
high - the high bound of the width and height value
Returns:
a random dimension where the height and width are values between low and high

randomDimension

public static Dimension randomDimension()
Creates a random dimension where the height and width are between the values MINIMUM_DIMENSION and MAXIMUM_DIMENSION (inclusive). This method is included to avoid the use of Integers in the calling code.

Returns:
a random dimension where the height and width are values between MINIMUM_DIMENSION and MAXIMUM_DIMENSION (inclusive).

randomPoint

public static Point randomPoint()
Creates a random dimension where the x and y coordinate are between the values MINIMUM_XY and MAXIMUM_XY (inclusive). This method is included to avoid the use of Integers in the calling code.

Returns:
a random point where the x and y coordinates are values between MINIMUM_XY and MAXIMUM_XY (inclusive).

randomPoint

public static Point randomPoint(Integer low,
                                Integer high)
Creates a random point where the x and y coordinates are between the given values (inclusive). The x and y coordinates are determined separately - meaning this will not always return a point where the x and y are the same. This version is used when you only specify one range. Should not be used if the x and y ranges are independent.

Parameters:
low - the low bound of the x and y value
high - the high bound of the x and y value
Returns:
a random point where the x and y coordinate values are between low and high

randomPoint

public static Point randomPoint(Integer lowX,
                                Integer highX,
                                Integer lowY,
                                Integer highY)
Creates a random point where the x and y coordinates are between the given values (inclusive). The x and y coordinates are determined separately - meaning this will not always return a point where the x and y are the same. This version is used when you want to vary the x and y ranges independently.

Parameters:
lowX - the low bound of the x coordinate value
highX - the high bound of the y coordinate value
lowY - the low bound of y coordinate value
highY - the high bound of the y coordinate value
Returns:
a random point where the x coordinate is between lowX and highX and the y coordinate value is between lowY and highY

randomSineMaker

public static SineMaker randomSineMaker()
Creates a random SineMaker

Returns:
a random SineMaker