com.caucho.util
Class RandomUtil

java.lang.Object
  extended by com.caucho.util.RandomUtil

public class RandomUtil
extends java.lang.Object

System-wide random number generator.


Constructor Summary
RandomUtil()
           
 
Method Summary
static void addRandom(long seed)
          Adds a random number to the server seed.
static void addRandom(java.lang.String random)
          Adds a random number based on a string.
static long getRandomLong()
          Returns the next random long.
static java.security.SecureRandom getSecureRandom()
          Sets the specific seed.
static java.util.Random getTestRandom()
           
static int nextInt(int n)
          Returns the next random int.
static void setSecureRandom(java.security.SecureRandom random)
          Sets the specific seed.
static void setTestSeed(long seed)
          Sets the specific seed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomUtil

public RandomUtil()
Method Detail

getRandomLong

public static long getRandomLong()
Returns the next random long.


nextInt

public static int nextInt(int n)
Returns the next random int.


addRandom

public static void addRandom(java.lang.String random)
Adds a random number based on a string.


addRandom

public static void addRandom(long seed)
Adds a random number to the server seed.


setTestSeed

public static void setTestSeed(long seed)
Sets the specific seed. Only for testing.


setSecureRandom

public static void setSecureRandom(java.security.SecureRandom random)
Sets the specific seed. Only for testing.


getSecureRandom

public static java.security.SecureRandom getSecureRandom()
Sets the specific seed. Only for testing.


getTestRandom

public static java.util.Random getTestRandom()