HE_Mesh2014  2.0.11
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
wblut.math.WB_MTRandom Class Reference
+ Inheritance diagram for wblut.math.WB_MTRandom:

Public Member Functions

Object clone () throws CloneNotSupportedException
 
boolean stateEquals (final Object o)
 
void readState (final DataInputStream stream) throws IOException
 
void writeState (final DataOutputStream stream) throws IOException
 
 WB_MTRandom ()
 
 WB_MTRandom (final long seed)
 
synchronized void setSeed (final long seed)
 
synchronized void reset ()
 
final int nextInt ()
 
final short nextShort ()
 
final char nextChar ()
 
final boolean nextBoolean ()
 
final boolean nextBoolean (final float probability)
 
final boolean nextBoolean (final double probability)
 
final byte nextByte ()
 
final void nextBytes (final byte[] bytes)
 
final long nextLong ()
 
final long nextLong (final long n)
 
final double nextDouble ()
 
final double nextCenteredDouble ()
 
final double nextGaussian ()
 
final float nextFloat ()
 
final float nextCenteredFloat ()
 
final int nextInt (final int n)
 

Private Attributes

int mt []
 
int mti
 
int mag01 []
 
double __nextNextGaussian
 
boolean __haveNextNextGaussian
 
long seed
 

Static Private Attributes

static final long serialVersionUID = 3636987267914792302L
 
static final int N = 624
 
static final int M = 397
 
static final int MATRIX_A = 0x9908b0df
 
static final int UPPER_MASK = 0x80000000
 
static final int LOWER_MASK = 0x7fffffff
 
static final int TEMPERING_MASK_B = 0x9d2c5680
 
static final int TEMPERING_MASK_C = 0xefc60000
 

Constructor & Destructor Documentation

wblut.math.WB_MTRandom.WB_MTRandom ( )

Constructor using the default seed.

wblut.math.WB_MTRandom.WB_MTRandom ( final long  seed)

Constructor using a given seed. Though you pass this seed in as a long, it's best to make sure it's actually an integer.

Parameters
seedthe seed

Member Function Documentation

Object wblut.math.WB_MTRandom.clone ( ) throws CloneNotSupportedException
final boolean wblut.math.WB_MTRandom.nextBoolean ( )

Next boolean.

Returns
next random boolean
final boolean wblut.math.WB_MTRandom.nextBoolean ( final float  probability)

This generates a coin flip with a probability probability of returning true, else returning false. probability must be between 0.0 and 1.0, inclusive. Not as precise a random real event as nextBoolean(double), but twice as fast. To explicitly use this, remember you may need to cast to float first.

Parameters
probabilitythe probability
Returns
next random coin flip
final boolean wblut.math.WB_MTRandom.nextBoolean ( final double  probability)

This generates a coin flip with a probability probability of returning true, else returning false. probability must be between 0.0 and 1.0, inclusive.

Parameters
probabilitythe probability
Returns
next random coin flip
final byte wblut.math.WB_MTRandom.nextByte ( )

Next byte.

Returns
next random byte
final void wblut.math.WB_MTRandom.nextBytes ( final byte[]  bytes)

Fill array of bytes with random values.

Parameters
bytesthe bytes
final double wblut.math.WB_MTRandom.nextCenteredDouble ( )

Returns a random double in the half-open range from [-0.5,0.5). Thus -0.5 is a valid result but 0.5 is not.

Returns
next random double in range [-0.5,0.51)
final float wblut.math.WB_MTRandom.nextCenteredFloat ( )

Returns a random float in the half-open range from [-0.5,0.5). Thus -0.5 is a valid result but 0.5 is not.

Returns
next random float in range [-0.5,0.5)
final char wblut.math.WB_MTRandom.nextChar ( )

Next char.

Returns
next random char
final double wblut.math.WB_MTRandom.nextDouble ( )

Returns a random double in the half-open range from [0.0,1.0). Thus 0.0 is a valid result but 1.0 is not.

Returns
next random double in range [0,1)
final float wblut.math.WB_MTRandom.nextFloat ( )

Returns a random float in the half-open range from [0.0f,1.0f). Thus 0.0f is a valid result but 1.0f is not.

Returns
next random float in range [0,1)
final double wblut.math.WB_MTRandom.nextGaussian ( )

Next gaussian.

Returns
the double
final int wblut.math.WB_MTRandom.nextInt ( )

Next int.

Returns
next random integer
final int wblut.math.WB_MTRandom.nextInt ( final int  n)

Returns an integer drawn uniformly from 0 to n-1. Suffice it to say, n must be > 0, or an IllegalArgumentException is raised.

Parameters
nthe n
Returns
next random integer in range 0 to n-1.
final long wblut.math.WB_MTRandom.nextLong ( )

Next long.

Returns
next random long
final long wblut.math.WB_MTRandom.nextLong ( final long  n)

Returns a long drawn uniformly from 0 to n-1. Suffice it to say, n must be > 0, or an IllegalArgumentException is raised.

Parameters
nthe n
Returns
next random long between 0 and n-1
final short wblut.math.WB_MTRandom.nextShort ( )

Next short.

Returns
next random short
void wblut.math.WB_MTRandom.readState ( final DataInputStream  stream) throws IOException

Reads the entire state of the MersenneTwister RNG from the stream.

Parameters
streamthe stream
Exceptions
IOExceptionSignals that an I/O exception has occurred.
synchronized void wblut.math.WB_MTRandom.reset ( )
synchronized void wblut.math.WB_MTRandom.setSeed ( final long  seed)

Initalize the pseudo random number generator. Don't pass in a long that's bigger than an int (Mersenne Twister only uses the first 32 bits for its seed).

Parameters
seedthe new seed
boolean wblut.math.WB_MTRandom.stateEquals ( final Object  o)

State equals.

Parameters
othe o
Returns
true, if successful
void wblut.math.WB_MTRandom.writeState ( final DataOutputStream  stream) throws IOException

Writes the entire state of the MersenneTwister RNG to the stream.

Parameters
streamthe stream
Exceptions
IOExceptionSignals that an I/O exception has occurred.

Member Data Documentation

boolean wblut.math.WB_MTRandom.__haveNextNextGaussian
private

The __have next next gaussian.

double wblut.math.WB_MTRandom.__nextNextGaussian
private

The __next next gaussian.

final int wblut.math.WB_MTRandom.LOWER_MASK = 0x7fffffff
staticprivate

The Constant LOWER_MASK.

final int wblut.math.WB_MTRandom.M = 397
staticprivate

The Constant M.

int wblut.math.WB_MTRandom.mag01[]
private

The mag01.

final int wblut.math.WB_MTRandom.MATRIX_A = 0x9908b0df
staticprivate

The Constant MATRIX_A.

int wblut.math.WB_MTRandom.mt[]
private

The mt.

int wblut.math.WB_MTRandom.mti
private

The mti.

final int wblut.math.WB_MTRandom.N = 624
staticprivate

The Constant N.

long wblut.math.WB_MTRandom.seed
private
final long wblut.math.WB_MTRandom.serialVersionUID = 3636987267914792302L
staticprivate

The Constant serialVersionUID.

final int wblut.math.WB_MTRandom.TEMPERING_MASK_B = 0x9d2c5680
staticprivate

The Constant TEMPERING_MASK_B.

final int wblut.math.WB_MTRandom.TEMPERING_MASK_C = 0xefc60000
staticprivate

The Constant TEMPERING_MASK_C.

final int wblut.math.WB_MTRandom.UPPER_MASK = 0x80000000
staticprivate

The Constant UPPER_MASK.


The documentation for this class was generated from the following file: