UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.util
Class Random

java.lang.Object
  |
  +--java.util.Random
        |
        +--edu.berkeley.guir.lib.util.Random
All Implemented Interfaces:
Serializable

public class Random
extends Random

Utilities for dealing with random numbers.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Jul 17 1998, JH
               Created class
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
1.1.4
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu), Chris Long ( allanl@cs.berkeley.edu)
See Also:
Serialized Form

Constructor Summary
Random()
          Default constructor.
Random(long seed)
           
 
Method Summary
 void nextBytes(byte[] bytes)
           
 double nextDouble()
           
 double nextDouble(double a, double b)
          Get a random float x, such that a <= x <= b (inclusive).
 float nextFloat()
           
 float nextFloat(float a, float b)
          Get a random float x, such that a <= x <= b (inclusive).
 double nextGaussian()
           
 int nextInt()
           
 int nextInt(int a, int b)
          Get a random integer x, such that a <= x <= b (inclusive).
 long nextLong()
           
 void setSeed(long seed)
           
static void shuffle(int[] a)
           
static void shuffle(int[] a, Random r)
           
static void shuffle(Object[] a)
           
static void shuffle(Object[] a, Random r)
           
static void shuffle(Vector v)
           
static void shuffle(Vector v, Random r)
           
 
Methods inherited from class java.util.Random
next, nextBoolean, nextInt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Random

public Random()
Default constructor. No instances allowed.

Random

public Random(long seed)
Method Detail

nextBytes

public void nextBytes(byte[] bytes)
Overrides:
nextBytes in class Random

nextDouble

public double nextDouble()
Overrides:
nextDouble in class Random

nextDouble

public double nextDouble(double a,
                         double b)
Get a random float x, such that a <= x <= b (inclusive).
Parameters:
a - is the lower bound.
b - is the upper bound. Please ensure a < b.
Returns:
a float between a and b inclusive.

nextFloat

public float nextFloat()
Overrides:
nextFloat in class Random

nextFloat

public float nextFloat(float a,
                       float b)
Get a random float x, such that a <= x <= b (inclusive).
Parameters:
a - is the lower bound.
b - is the upper bound. Please ensure a < b.
Returns:
a float between a and b inclusive.

nextGaussian

public double nextGaussian()
Overrides:
nextGaussian in class Random

nextInt

public int nextInt()
Overrides:
nextInt in class Random

nextInt

public int nextInt(int a,
                   int b)
Get a random integer x, such that a <= x <= b (inclusive).
Parameters:
a - is the lower bound.
b - is the upper bound. Please ensure a < b.
Returns:
an integer between a and b inclusive.

nextLong

public long nextLong()
Overrides:
nextLong in class Random

setSeed

public void setSeed(long seed)
Overrides:
setSeed in class Random

shuffle

public static void shuffle(int[] a)

shuffle

public static void shuffle(int[] a,
                           Random r)

shuffle

public static void shuffle(Object[] a)

shuffle

public static void shuffle(Object[] a,
                           Random r)

shuffle

public static void shuffle(Vector v)

shuffle

public static void shuffle(Vector v,
                           Random r)

Copyright Information