List of utility methods to do Random
List | randomUniformUniqueIntegerList(int sz) random Uniform Unique Integer List List<Integer> lst = new ArrayList<>(sz); for (int i = 0; i < sz; i++) lst.add(i); Collections.shuffle(lst); return lst; |
String | randomValue() random Value double currentTimeMillis = System.currentTimeMillis() * Math.random(); return String.valueOf(Math.round(currentTimeMillis)); |
T | randomValue(T[] array) random Value int index = (int) (Math.random() * array.length); return array[index]; |
int[] | randomVector(int size) Creates a random vector of integers of length size return randomVector(size, Integer.MAX_VALUE);
|
Random | randRandom(Random random) rand Random return new Random(random.nextInt(Integer.MAX_VALUE)); |
float | randRange(float from, float to) rand Range return ((float) Math.random() * (to - from)) + from; |
float | randRangeDecimal(float min, float max) Calculates a random number within a minimum and maximum range. return (float) Math.random() * (max - min) + min; |
void | resetRandomGenerator() reset Random Generator randomGenerator.setSeed(GATK_RANDOM_SEED); |
D | runProbability(Random rng, float[] probs, D[] choices) run Probability float tProb = 0; for (int i = 0; i < probs.length; i++) { tProb += probs[i]; float s = rng.nextFloat() * tProb; int c = 0; for (int i = 0; i < probs.length; i++) { s -= probs[i]; ... |