is.logi.crypto.random
Class RandomFromReader

java.lang.Object
  |
  +--java.util.Random
        |
        +--is.logi.crypto.random.RandomFromReader

public class RandomFromReader
extends java.util.Random

This class reads bits from a Reader object and returns them as random values. No randomness checking is done and an Error is thrown if the end of the Reader is ever reached.

This class is useful f.ex. for reding random bits from the /dev/random or /dev/urandom deviced in linux. This would be done with the following code:

 Random rand;
 try {
   rand=new RandomFromReader(new FileReader("/dev/random"));
 } catch (FileNotFoundException e) {
   rand=new RandomSpinner();
 }
 

Author:
Logi Ragnarsson (logir@hi.is)
See Also:
Serialized Form

Constructor Summary
RandomFromReader(java.io.Reader r)
          Create a new RandomFromReader obejct.
 
Methods inherited from class java.util.Random
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomFromReader

public RandomFromReader(java.io.Reader r)
Create a new RandomFromReader obejct. Random bits are read from r


Copyright 1997-1999 Logi Ragnarsson