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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Random
public Random()
- Default constructor. No instances allowed.
Random
public Random(long seed)
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)