public final class Next extends Object
static methods for generating random byte arrays, string and
primitive values. Actual pseudo number generation is delegated to the
Random class. Random string generation is delegated to the
RandomString class.
Please not that this class is designed to be used in testing environments only. It is not designed to be used in production.
| Modifier and Type | Method and Description |
|---|---|
static void |
bytes(byte[] bytes)
Fills the specified byte array with next random byte values.
|
static byte[] |
bytes(int length)
Creates and returns a new byte array with the specified length filled with
next random byte values.
|
static double |
doubleValue()
Returns the next random double value.
|
static int |
intValue()
Returns the next random int value.
|
static int |
intValue(int bound)
Returns the next random int value between zero (inclusive) and the
specified value (exclusive).
|
static String |
string(int length)
Returns the next random string with the specified length.
|
public static void bytes(byte[] bytes)
bytes - the array to be filled with next random byte valuesRandom.nextBytes(byte[])public static byte[] bytes(int length)
length - the length of the array to be createdRandom.nextBytes(byte[])public static double doubleValue()
Random.nextDouble()public static int intValue()
Random.nextInt()public static int intValue(int bound)
Random.nextInt(int)public static String string(int length)
RandomString.nextString(int)Copyright © 2021–2022 Objectos Software LTDA. All rights reserved.