Based on an idea from Marcus Lippert.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] | generateSeed(int
the number of bytes to generate numBytes, boolean true if fast mode should be used fast)Generate seed bytes. |
| ThreadedSeedGenerator | back to summary |
|---|---|
| public ThreadedSeedGenerator() | |
| generateSeed | back to summary |
|---|---|
| public byte[] generateSeed(int numBytes, boolean fast) Generate seed bytes. Set fast to false for best quality. If fast is set to true, the code should be round about 8 times faster when generating a long sequence of random bytes. 20 bytes of random values using the fast mode take less than half a second on a Nokia e70. If fast is set to false, it takes round about 2500 ms.
| |
| Modifier and Type | Field and Description |
|---|---|
| private volatile int | |
| private volatile boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] | |
| public void |
| counter | back to summary |
|---|---|
| private volatile int counter | |
| stop | back to summary |
|---|---|
| private volatile boolean stop | |
| SeedGenerator | back to summary |
|---|---|
| private SeedGenerator() | |
| generateSeed | back to summary |
|---|---|
| public byte[] generateSeed(int numbytes, boolean fast) | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation. | |