edu.usc.bg.base
Class Utils

java.lang.Object
  extended by edu.usc.bg.base.Utils

public class Utils
extends java.lang.Object

Utility functions.


Field Summary
static int FNV_offset_basis_32
           
static long FNV_offset_basis_64
           
static int FNV_prime_32
           
static long FNV_prime_64
           
 
Constructor Summary
Utils()
           
 
Method Summary
static java.lang.String ASCIIString(int length)
          Generate a random ASCII string of a given length.
static int FNVhash32(int val)
          32 bit FNV hash.
static long FNVhash64(long val)
          64 bit FNV hash.
static long hash(long val)
          Hash an integer value.
static java.util.Random random()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FNV_offset_basis_32

public static final int FNV_offset_basis_32
See Also:
Constant Field Values

FNV_prime_32

public static final int FNV_prime_32
See Also:
Constant Field Values

FNV_offset_basis_64

public static final long FNV_offset_basis_64
See Also:
Constant Field Values

FNV_prime_64

public static final long FNV_prime_64
See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

random

public static java.util.Random random()

ASCIIString

public static java.lang.String ASCIIString(int length)
Generate a random ASCII string of a given length.


hash

public static long hash(long val)
Hash an integer value.


FNVhash32

public static int FNVhash32(int val)
32 bit FNV hash. Produces more "random" hashes than (say) String.hashCode().

Parameters:
val - The value to hash.
Returns:
The hash value

FNVhash64

public static long FNVhash64(long val)
64 bit FNV hash. Produces more "random" hashes than (say) String.hashCode().

Parameters:
val - The value to hash.
Returns:
The hash value