-
-
Notifications
You must be signed in to change notification settings - Fork 43
Random
psambit9791 edited this page Dec 10, 2023
·
5 revisions
The Random class provides utilities to generate pseudo-random numbers based on some distribution.
Although JAVA provides a Random class, it does not provide a consistent way to generate Random numbers and especially matrices. This class allows us to generate random numbers as samples or as matrices (supported to generate upto 3-dimensional matrices).
Currently, it supports the following distributions:
- Normal Distribution
- Uniform Distribution
- As doubles in the range of 0.0 and 1.0
- As ints in a provided range
long seed = 42;
Random r1 = new Random(seed);
r1.setMeanAndSD(10.0, 1.0); //Optional; default is mean = 0.0 and S.D = 1.0
double sample = r1.randomNormalSample();
double[] arrayOne = r1.randomNormal1D(new int[]{4});
double[] arrayTwo = r1.randomNormal2D(new int[]{3, 3});
double[] arrayThree = r1.randomNormal3D(new int[]{2, 2, 2});
Sample:
Array One:
Array Two:
long seed = 42;
Random r1 = new Random(seed);
double sample = r1.randomDoubleSample();
double[] arrayOne = r1.randomDouble1D(new int[]{4});
double[] arrayTwo = r1.randomDouble2D(new int[]{3, 3});
double[] arrayThree = r1.randomDouble3D(new int[]{2, 2, 2});
Sample:
Array One:
Array Two:
long seed = 42;
Random r1 = new Random(seed);
int sample = r1.randomIntSample();
int[] arrayOne = r1.randomInt1D(new int[]{4}, 5, 10);
int[] arrayTwo = r1.randomInt2D(new int[]{3, 3}, 5, 10);
int[] arrayThree = r1.randomInt3D(new int[]{2, 2, 2}, 5, 10);
Sample:
Array One:
Array Two:
Wiki
-
Filters
- IIR Filters
- FIR Filters
- Kernel-Based Filter
- Adaptive Filters
-
Signals
-
Peak Detection
-
Transformations
-
Speech
-
Windowing