net.obsearch.index.utils
Class OBRandom

java.lang.Object
  extended by net.obsearch.index.utils.OBRandom

public class OBRandom
extends Object

A class used to generate random numbers. We use an implementation that seems to be better than the one provided by JDK. Every time you instantiate this class, a new seed will be generated!


Constructor Summary
OBRandom()
          When you create an OBRandom, a seed is generated by using a special seed generator.
 
Method Summary
 boolean nextBoolean()
          Returns the next boolean value from this random number generator's sequence.
 float nextFloat()
          Returns a 32 bit uniformly distributed random number in the open unit interval (0.0f,1.0f) (excluding 0.0f and 1.0f)
 int nextInt(int n)
          Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OBRandom

public OBRandom()
When you create an OBRandom, a seed is generated by using a special seed generator.

Method Detail

nextFloat

public float nextFloat()
Returns a 32 bit uniformly distributed random number in the open unit interval (0.0f,1.0f) (excluding 0.0f and 1.0f)


nextBoolean

public boolean nextBoolean()
Returns the next boolean value from this random number generator's sequence.


nextInt

public int nextInt(int n)
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)

Parameters:
n - the bound on the random number to be returned. Must be positive.
Returns:
the next pseudorandom, uniformly distributed int value between 0 (inclusive) and n (exclusive) from this random number generator's sequence


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.