Package weka.core

# Class Debug.Random

java.lang.Object
java.util.Random
weka.core.Debug.Random

All Implemented Interfaces:
  `Serializable`, `RandomGenerator`, `RevisionHandler`

Enclosing class:
  `Debug`

public static class Debug.Random extends Random implements Serializable, RevisionHandler
This extended Random class enables one to print the generated random numbers etc., before they are returned. It can either use stdout (default) for outputting the logging information or a Log object (level is then INFO).

Version:
  $Revision: 7519 $
Author:
  FracPete (fracpete at waikato dot ac dot nz)
See Also:
  - Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from interface java.util.random.RandomGenerator

`RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator`

## Constructor Summary

Constructors
Constructor
Description
`Random()`
Creates a new random number generator.
`Random(boolean debug)`
Creates a new random number generator.
`Random(long seed)`
Creates a new random number generator using a single long seed.
`Random(long seed, boolean debug)`
Creates a new random number generator using a single long seed.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`getDebug()`
returns whether to print the generated random values or not
`long`
`getID()`
returns the unique ID of this number generator
`Debug.Log`
`getLog()`
the currently used log, if null then stdout is used for outputting the debugging information
`String`
`getRevision()`
Returns the revision string.
`boolean`
`nextBoolean()`
Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.
`void`
`nextBytes(byte[] bytes)`
Generates random bytes and places them into a user-supplied byte array.
`double`
`nextDouble()`
Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
`float`
`nextFloat()`
Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.
`double`
`nextGaussian()`
Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.
`int`
`nextInt()`
Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
`int`
`nextInt(int n)`
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.
`long`
`nextLong()`
Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.
`void`
`printStackTrace()`
prints the current stacktrace
`void`
`setDebug(boolean value)`
sets whether to print the generated random values or not
`void`
`setLog(Debug.Log value)`
the log to use, if it is null then stdout is used
`void`
`setSeed(long seed)`
Sets the seed of this random number generator using a single long seed.
`String`
`toString()`
returns a string representation of this number generator

### Methods inherited from class java.util.Random

`doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.random.RandomGenerator

`isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong, nextLong`

## Constructor Details

### Random

public Random()
Creates a new random number generator. With no debugging.

### Random

public Random(long seed)
Creates a new random number generator using a single long seed. With no debugging

Parameters:
  `seed` - the seed value

### Random

public Random(boolean debug)
Creates a new random number generator. With optional debugging.

Parameters:
  `debug` - if true, debugging output is enabled

### Random

public Random(long seed, boolean debug)
Creates a new random number generator using a single long seed. With optional debugging

Parameters:
  `seed` - the seed value
  `debug` - if true, debugging output is enabled

## Method Details

### setDebug

public void setDebug(boolean value)
sets whether to print the generated random values or not

Parameters:
  `value` - if true debugging output is enabled

### getDebug

public boolean getDebug()
returns whether to print the generated random values or not

Returns:
  true if debugging output is enabled

### setLog

public void setLog(Debug.Log value)
the log to use, if it is null then stdout is used

Parameters:
  `value` - the log to use

### getLog

public Debug.Log getLog()
the currently used log, if null then stdout is used for outputting the debugging information

Returns:
  the log, can be null

### getID

public long getID()
returns the unique ID of this number generator

Returns:
  the unique ID of this number generator

### printStackTrace

public void printStackTrace()
prints the current stacktrace

### nextBoolean

public boolean nextBoolean()
Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

Specified by:
  `nextBoolean` in interface `RandomGenerator`
Overrides:
  `nextBoolean` in class `Random`
Returns:
  random boolean

### nextBytes

public void nextBytes(byte[] bytes)
Generates random bytes and places them into a user-supplied byte array.

Specified by:
  `nextBytes` in interface `RandomGenerator`
Overrides:
  `nextBytes` in class `Random`
Parameters:
  `bytes` - array to fill with random bytes

### nextDouble

public double nextDouble()
Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

Specified by:
  `nextDouble` in interface `RandomGenerator`
Overrides:
  `nextDouble` in class `Random`
Returns:
  random double

### nextFloat

public float nextFloat()
Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

Specified by:
  `nextFloat` in interface `RandomGenerator`
Overrides:
  `nextFloat` in class `Random`
Returns:
  random float

### nextGaussian

public double nextGaussian()
Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

Specified by:
  `nextGaussian` in interface `RandomGenerator`
Overrides:
  `nextGaussian` in class `Random`
Returns:
  random double, gaussian distributed

### nextInt

public int nextInt()
Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.

Specified by:
  `nextInt` in interface `RandomGenerator`
Overrides:
  `nextInt` in class `Random`
Returns:
  random int

### nextInt

public int nextInt(int n)
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

Specified by:
  `nextInt` in interface `RandomGenerator`
Overrides:
  `nextInt` in class `Random`
Parameters:
  `n` - the upper limit (exclusive)
Returns:
  random int

### nextLong

public long nextLong()
Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.

Specified by:
  `nextLong` in interface `RandomGenerator`
Overrides:
  `nextLong` in class `Random`
Returns:
  random long

### setSeed

public void setSeed(long seed)
Sets the seed of this random number generator using a single long seed.

Overrides:
  `setSeed` in class `Random`
Parameters:
  `seed` - the seed value

### toString

public String toString()
returns a string representation of this number generator

Overrides:
  `toString` in class `Object`
Returns:
  a string representation

### getRevision

public String getRevision()
Returns the revision string.

Specified by:
  `getRevision` in interface `RevisionHandler`
Returns:
  the revision