wtanaka.praya.gale
Class YarrowRandom

java.lang.Object
  |
  +--java.util.Random
        |
        +--wtanaka.praya.gale.YarrowRandom
All Implemented Interfaces:
java.io.Serializable

public class YarrowRandom
extends java.util.Random

Yarrow Pseudo Random Number Generator. This is the generic version of Yarrow.

Return to Sourceforge or the Praya Homepage

Version:
$Name: $ $Date: 2001/10/08 12:54:49 $
Author:
$Author: wtanaka $
See Also:
Serialized Form

Fields inherited from class java.util.Random
addend, BITS_PER_BYTE, BYTES_PER_INT, haveNextNextGaussian, mask, multiplier, nextNextGaussian, seed, serialVersionUID
 
Constructor Summary
YarrowRandom(byte[] seed, java.security.MessageDigest h, java.io.FilterInputStream e)
          Constructor.
YarrowRandom(java.security.MessageDigest h, java.io.FilterInputStream e)
          Constructor.
 
Method Summary
 int next(int numBits)
          Generates an integer containing the user-specified number of pseudo-random bits (right justified, with leading zeros).
 void nextBytes(byte[] result)
          Reseeds this random object, using the eight bytes contained in the given long seed.
 void setSeed(long seed)
          Reseeds this random object, using the eight bytes contained in the given long seed.
 
Methods inherited from class java.util.Random
nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

YarrowRandom

public YarrowRandom(java.security.MessageDigest h,
                    java.io.FilterInputStream e)
Constructor.
Parameters:
h - one-way hash function h(x) with an m bit output size.
e - block cipher E() with a k-bit key size and an n-bit block size.

YarrowRandom

public YarrowRandom(byte[] seed,
                    java.security.MessageDigest h,
                    java.io.FilterInputStream e)
Constructor.
Parameters:
h - one-way hash function h(x) with an m bit output size.
e - block cipher E() with a k-bit key size and an n-bit block size.
Method Detail

next

public int next(int numBits)
Generates an integer containing the user-specified number of pseudo-random bits (right justified, with leading zeros). This method overrides a java.util.Random method, and serves to provide a source of random bits to all of the methods inherited from that class (for example, nextInt, nextLong, and nextFloat).
Overrides:
next in class java.util.Random
Parameters:
numBits - number of pseudo-random bits to be generated, where 0 <= numBits <= 32.

nextBytes

public void nextBytes(byte[] result)
Reseeds this random object, using the eight bytes contained in the given long seed. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness. This method is defined for compatibility with java.util.Random.
Overrides:
nextBytes in class java.util.Random

setSeed

public void setSeed(long seed)
Reseeds this random object, using the eight bytes contained in the given long seed. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness. This method is defined for compatibility with java.util.Random.
Overrides:
setSeed in class java.util.Random
Parameters:
seed - the seed