|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--de.flexiprovider.common.util.SeedGenerator
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.
| Constructor Summary | |
SeedGenerator()
|
|
| Method Summary | |
byte[] |
generateSeed(int numBytes)
|
void |
run()
|
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public SeedGenerator()
| Method Detail |
public byte[] generateSeed(int numBytes)
public void run()
run in interface java.lang.Runnable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||