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)
 
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).