rcf.system.random
Class RandomJavaAdapter

java.lang.Object
  extended by rcf.system.random.RandomJavaAdapter
All Implemented Interfaces:
Random

@Revision(value="$Revision: 1.3 $",
          date="$Date: 2006/11/09 02:10:28 $",
          tag="$Name:  $")
public class RandomJavaAdapter
extends Object
implements Random

TODO: Javadoc TODO: Unit tests, Code review, Javadoc review, Seal/Finalize TODO: equals, hashCode, toString

Version:
$Revision: 1.3 $
Author:
Greg Gibeling

Field Summary
protected  Random random
          TODO: Javadoc The java random number generator which is being adapted.
 
Constructor Summary
RandomJavaAdapter()
          TODO: Javadoc
RandomJavaAdapter(Random _random)
          TODO: Javadoc
 
Method Summary
 int randomBits(int bits)
          TODO: Javadoc Generate a random bitstring of the requested length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

protected final Random random
TODO: Javadoc The java random number generator which is being adapted.

Constructor Detail

RandomJavaAdapter

public RandomJavaAdapter()
TODO: Javadoc


RandomJavaAdapter

public RandomJavaAdapter(Random _random)
TODO: Javadoc

Parameters:
_random -
Method Detail

randomBits

public int randomBits(int bits)
Description copied from interface: Random
TODO: Javadoc Generate a random bitstring of the requested length. This method is preferable to most standard generate-a-random-integer methods, as it will return only as many bits as needed, making it easier both for the caller and the random bitsource.

Note that this method can be thought of as equivalent to performing bits independant, random coin tosses.

Specified by:
randomBits in interface Random
Parameters:
bits - The number of random bits to generate. Given the size of the int datatype in java, this parameter must be 32 or less. Note that asking for 0 random bits will simply return the number 0.
Returns:
An integer, whose highest bits are all 0 and whose lowest bits bits are randomly generated.