net.derquinse.common.test
Class RandomSupport

java.lang.Object
  extended by net.derquinse.common.test.RandomSupport

public final class RandomSupport
extends Object

Randomness support class for tests.

Author:
Andres Rodriguez

Method Summary
static byte[] getBytes(int amount)
          Generates a user-specified number of random bytes.
static InputSupplier<ByteArrayInputStream> getSupplier(int amount)
          Generates a user-specified number of random bytes, returning them as an input supplier.
static int nextInt()
          Returns a pseudorandom, uniformly distributed int.
static int nextInt(int max)
          Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive).
static int nextInt(int min, int max)
          Returns a pseudorandom, uniformly distributed int value between the min argument (inclusive) and the max argument (exclusive).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nextInt

public static int nextInt()
Returns a pseudorandom, uniformly distributed int.


nextInt

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


nextInt

public static int nextInt(int min,
                          int max)
Returns a pseudorandom, uniformly distributed int value between the min argument (inclusive) and the max argument (exclusive).


getBytes

public static byte[] getBytes(int amount)
Generates a user-specified number of random bytes.


getSupplier

public static InputSupplier<ByteArrayInputStream> getSupplier(int amount)
Generates a user-specified number of random bytes, returning them as an input supplier.



Copyright © 2012 Derquinse Projects. All Rights Reserved.