wabadma.util
Class DLWRandom

java.lang.Object
  |
  +--wabadma.util.DLWRandom

public class DLWRandom
extends java.lang.Object

This class provides a non-secure pseudo-random number generator designed for use with waba and PalmOS. DLW stands for either Dave's Lame Waba (Random) or Dave's LCG Waba (Random).

Version:
1.0, 2000 Nov 05
Author:
David M. Archer
See Also:
"Applied Cryptography by Bruce Schneier (Ch.15, pg. 347, blue ed.)"

Constructor Summary
DLWRandom()
          Creates a new DLWRandom object and seeds it with a value based on the current time.
DLWRandom(int i)
          Creates a new DLWRandom object and seeds it with the given value.
 
Method Summary
 int get()
          Get the generator's register without advancing it.
 int next()
          Get the next value in the generator's sequence.
 int random(int i)
          Get a (non-secure, pseudo-)random value from 0..(i-1).
 void set(int i)
          Set the generator's register to a given value, essentially reseeding the generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DLWRandom

public DLWRandom()
Creates a new DLWRandom object and seeds it with a value based on the current time.

DLWRandom

public DLWRandom(int i)
Creates a new DLWRandom object and seeds it with the given value.
Parameters:
i - Value with which to seed the generator.
Method Detail

set

public void set(int i)
Set the generator's register to a given value, essentially reseeding the generator.
Parameters:
i - Value to reset (reseed) the generator with.

get

public int get()
Get the generator's register without advancing it. Repeated calls to this routine will return the same value. Mostly only useful for test programs.

next

public int next()
Get the next value in the generator's sequence.

random

public int random(int i)
Get a (non-secure, pseudo-)random value from 0..(i-1).
Parameters:
i - Modulus of random number wanted.