org.logi.crypto.random
Class Spinner

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.logi.crypto.random.Spinner
All Implemented Interfaces:
java.lang.Runnable

public class Spinner
extends java.lang.Thread

Helper class for the PureSpinner class. This code is in the public domain.

Version:
1.1.1
See Also:
PureSpinner

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static int guessTime(int n)
          Returns t such that spin(t) is larger than n.
static void main(java.lang.String[] arg)
          Call with optional parameter t.
 void run()
          Sleep for the specified amount and then die.
static int spin(long t)
          Return the number of spins performed in t milliseconds.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

spin

public static int spin(long t)
Return the number of spins performed in t milliseconds.

run

public void run()
Sleep for the specified amount and then die.
Overrides:
run in class java.lang.Thread

guessTime

public static int guessTime(int n)
Returns t such that spin(t) is larger than n. This value may change as the load of the system changes.

main

public static void main(java.lang.String[] arg)
                 throws java.io.IOException
Call with optional parameter t.

Calls spin(t) 2^20 times and outputs the 8 lowest-order bits to a file named "spin.t", where t is replaced with the value of the parameter t.

If t is omitted, t=guessTime(1024) will be used.

the output of this program can be compressed to estimate the entropy of the random number generator. On my system the output does not compress at all for t>=5.



Copyright (c) 1997-2001 Logi Ragnarsson - Distributed under the GPL