All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class IS.hi.logir.cryptonite.RandomSpinner

java.lang.Object
   |
   +----java.util.Random
           |
           +----IS.hi.logir.cryptonite.RandomSpinner

public class RandomSpinner
extends Random
This class uses the scheduler to generate random numbers. It counts the number of times a loop is repeated before a thread has slept for a specified number of milliseconds. The two lowest order bits of this number are then used.

The helper class which does the actual number generation is by Henry Strickland (strix@versant.com) and Greg Noel (greg@qualcomm.com). It is based on similar C code by Matt Blaze, Jack Lacy, and Don Mitchell.

Author:
Logi Ragnarsson (logir@hi.is)

Variable Index

 o NUM_ITER

Constructor Index

 o RandomSpinner()

Method Index

 o isRandom()
Test randomness.
 o next(int)
Generates the next random number.

Variables

 o NUM_ITER
 private static final int NUM_ITER

Constructors

 o RandomSpinner
 public RandomSpinner()

Methods

 o next
 protected synchronized int next(int bits)
Generates the next random number.

Overrides:
next in class Random
 o isRandom
 public static boolean isRandom()
Test randomness. This is done by applying a chi-square test to the 2 lowest bits of the values returned by the Spinner helper class and by applying a chi-square test to the lengths of the gaps between identical values in the random stream.


All Packages  Class Hierarchy  This Package  Previous  Next  Index