de.flexiprovider.common.util
Class SeedGenerator

java.lang.Object
  |
  +--de.flexiprovider.common.util.SeedGenerator
All Implemented Interfaces:
java.lang.Runnable

public class SeedGenerator
extends java.lang.Object
implements java.lang.Runnable

This implementation provides a software based seed-generator which useses the multithreading capabilities of Java to get "truly" random bits. It uses two threads A and B. A starts B and sleeps for a certain amount of time (50 ms). Meanwhile B starts counting up a global variable. When A wakes up again it stops B and checks if the content of the global variable is odd (-> generate a '1') or even (-> generate a '0'). This process is repeated for each bit.

The main function is generateSeed(int n) which computes a seed of n bytes. The main idea of the algorithm is based on an idea of Marcus Lippert.

Author:
Erik Tews

Constructor Summary
SeedGenerator()
           
 
Method Summary
 byte[] generateSeed(int numBytes)
           
 void run()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeedGenerator

public SeedGenerator()
Method Detail

generateSeed

public byte[] generateSeed(int numBytes)

run

public void run()
Specified by:
run in interface java.lang.Runnable