net.sf.colossus.util
Class DevRandom

java.lang.Object
  extended by java.util.Random
      extended by net.sf.colossus.util.DevRandom
All Implemented Interfaces:
java.io.Serializable

public class DevRandom
extends java.util.Random

Class DevRandom generates random bits (same interface as class Random). Which random data source to use can be specified by providing a property called "net.sf.colossus.randomFile" (see randomPropertyName) or as argument to the constructor. If no special source is specified or the specified source is unreachable then it falls back on the regular java Random class.

Author:
Romain Dolbeau, David Ripton
See Also:
Serialized Form

Field Summary
private static java.util.logging.Logger LOGGER
           
private static java.lang.String PRNG
           
private static java.lang.String randomPropertyName
           
private static java.lang.String randomPropertySource
           
private  java.io.File randomSource
           
private  java.io.FileInputStream randStream
           
private  java.lang.String source
           
 
Constructor Summary
DevRandom()
           
DevRandom(java.lang.String sourcename)
           
 
Method Summary
private  java.lang.String getRandomSourceFromProperties()
           
private  void init()
           
protected  int next(int bits)
           
private  boolean tryOneSource(java.lang.String src)
           
 
Methods inherited from class java.util.Random
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

PRNG

private static final java.lang.String PRNG
See Also:
Constant Field Values

source

private java.lang.String source

randomSource

private java.io.File randomSource

randStream

private java.io.FileInputStream randStream

randomPropertyName

private static final java.lang.String randomPropertyName
See Also:
Constant Field Values

randomPropertySource

private static java.lang.String randomPropertySource
Constructor Detail

DevRandom

public DevRandom()

DevRandom

public DevRandom(java.lang.String sourcename)
Method Detail

getRandomSourceFromProperties

private java.lang.String getRandomSourceFromProperties()

tryOneSource

private boolean tryOneSource(java.lang.String src)

init

private void init()

next

protected int next(int bits)
Overrides:
next in class java.util.Random