rcf.system.random
Interface Random

All Known Implementing Classes:
RandomJavaAdapter

@Revision(value="$Revision: 1.4 $",
          date="$Date: 2006/11/09 02:10:28 $",
          tag="$Name:  $")
public interface Random

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

Version:
$Revision: 1.4 $
Author:
Greg Gibeling

Method Summary
 int randomBits(int bits)
          TODO: Javadoc Generate a random bitstring of the requested length.
 

Method Detail

randomBits

int randomBits(int bits)
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.

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.