Package io.deephaven.function
Class Random
java.lang.Object
io.deephaven.function.Random
Functions for the generation random numbers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
random()
Returns a uniform random number between0.0
(inclusive) and1.0
(exclusive).static boolean
Returns a random boolean.static boolean[]
randomBool
(int size) Returns an array of random booleans.static double
randomDouble
(double min, double max) Returns a uniform random number.static double[]
randomDouble
(double min, double max, int size) Returns an array of uniform random numbers.static float
randomFloat
(float min, float max) Returns a uniform random number.static float[]
randomFloat
(float min, float max, int size) Returns an array of uniform random numbers.static double
randomGaussian
(double mean, double std) Returns a Gaussian random number.static double[]
randomGaussian
(double mean, double std, int size) Returns an array of Gaussian random numbers.static int
randomInt
(int min, int max) Returns a uniform random number.static int[]
randomInt
(int min, int max, int size) Returns an array of uniform random numbers.static long
randomLong
(long min, long max) Returns a uniform random number.static long[]
randomLong
(long min, long max, int size) Returns an array of uniform random numbers.
-
Constructor Details
-
Random
public Random()
-
-
Method Details
-
random
public static double random()Returns a uniform random number between0.0
(inclusive) and1.0
(exclusive).- Returns:
- uniform random number between
0.0
(inclusive) and1.0
(exclusive).
-
randomBool
public static boolean randomBool()Returns a random boolean.- Returns:
- random boolean.
-
randomBool
public static boolean[] randomBool(int size) Returns an array of random booleans.- Parameters:
size
- array size to generate.- Returns:
- array of random booleans.
-
randomInt
public static int randomInt(int min, int max) Returns a uniform random number.- Parameters:
min
- minimum result.max
- maximum result (exclusive).- Returns:
- uniform random number between
min
(inclusive) andmax
(exclusive).
-
randomInt
public static int[] randomInt(int min, int max, int size) Returns an array of uniform random numbers.- Parameters:
min
- minimum result.max
- maximum result (exclusive).size
- array size to generate.- Returns:
- array of uniform random numbers between
min
(inclusive) andmax
(exclusive).
-
randomLong
public static long randomLong(long min, long max) Returns a uniform random number.- Parameters:
min
- minimum result.max
- maximum result (exclusive).- Returns:
- uniform random number between
min
(inclusive) andmax
(exclusive).
-
randomLong
public static long[] randomLong(long min, long max, int size) Returns an array of uniform random numbers.- Parameters:
min
- minimum result.max
- maximum result (exclusive).size
- array size to generate.- Returns:
- array of uniform random numbers between
min
(inclusive) andmax
(exclusive).
-
randomFloat
public static float randomFloat(float min, float max) Returns a uniform random number.- Parameters:
min
- minimum result.max
- maximum result.- Returns:
- uniform random number between
min
(inclusive) andmax
(exclusive).
-
randomFloat
public static float[] randomFloat(float min, float max, int size) Returns an array of uniform random numbers.- Parameters:
min
- minimum result.max
- maximum result.size
- array size to generate.- Returns:
- array of uniform random numbers between
min
(inclusive) andmax
(exclusive).
-
randomDouble
public static double randomDouble(double min, double max) Returns a uniform random number.- Parameters:
min
- minimum result.max
- maximum result.- Returns:
- uniform random number between
min
(inclusive) andmax
(exclusive).
-
randomDouble
public static double[] randomDouble(double min, double max, int size) Returns an array of uniform random numbers.- Parameters:
min
- minimum result.max
- maximum result.size
- array size to generate.- Returns:
- array of uniform random numbers between
min
(inclusive) andmax
(exclusive).
-
randomGaussian
public static double randomGaussian(double mean, double std) Returns a Gaussian random number.- Parameters:
mean
- mean.std
- standard deviation.- Returns:
- Gaussian random number.
-
randomGaussian
public static double[] randomGaussian(double mean, double std, int size) Returns an array of Gaussian random numbers.- Parameters:
mean
- mean.std
- standard deviation.size
- array size to generate.- Returns:
- array of Gaussian random numbers.
-