net.burtleburtle.bob.rand
Class ISAACAlgorithm

java.lang.Object
  extended by net.burtleburtle.bob.rand.ISAACAlgorithm

 class ISAACAlgorithm
extends java.lang.Object

ISAAC: a fast cryptographic pseudo-random number generator

ISAAC (Indirection, Shift, Accumulate, Add, and Count) generates 32-bit random numbers.
ISAAC has been designed to be cryptographically secure and is inspired by RC4.
Cycles are guaranteed to be at least 240 values long, and they are 28295 values long on average.
The results are uniformly distributed, unbiased, and unpredictable unless you know the seed.

This is the original implementation by Bob Jenkins with some minor changes.

Changelog:

Version:
050325
Author:
Bob Jenkins

Constructor Summary
ISAACAlgorithm()
          This constructor creates and initializes an new instance without using a seed.
ISAACAlgorithm(int[] seed)
          This constructor creates and initializes an new instance using a user-provided seed.
 
Method Summary
(package private)  int nextInt()
          Get a random integer value.
(package private)  void supplementSeed(int[] seed)
          Reseeds this random object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISAACAlgorithm

ISAACAlgorithm()
This constructor creates and initializes an new instance without using a seed.
Equivalent to randinit(ctx,FALSE) in the C implementation.


ISAACAlgorithm

ISAACAlgorithm(int[] seed)
This constructor creates and initializes an new instance using a user-provided seed.
Equivalent to randinit(ctx, TRUE) after putting seed in randctx in the C implementation.

Parameters:
seed - The seed.
Method Detail

nextInt

final int nextInt()
Get a random integer value.


supplementSeed

final void supplementSeed(int[] seed)
Reseeds this random object.
The given seed supplements (using bitwise xor), rather than replaces, the existing seed.

Parameters:
seed - An integer array containing the seed.