List of utility methods to do Random
float | randomFloat(float aVal) Returns a random float up to given value. return Math.abs(_random.nextInt()) / (float) Integer.MAX_VALUE * aVal; |
float | randomFloat(float min, float max) random Float return (float) (Math.random() * (max - min) + min); |
float | randomFloatBetween(float begin, float end) random Float Between float rand = (float) Math.random(); return begin + (rand * ((end - begin))); |
T | randomFromIterator(Iterator random From Iterator if (!iter.hasNext()) { return null; T element = iter.next(); double seen = 1; while (iter.hasNext()) { seen += 1; T posReplace = iter.next(); ... |
List | randomGaussian(int numElements) random Gaussian return randomGaussian(numElements, 1.0);
|
double[] | randomGreyLevels(double max, double min) random Grey Levels double del = max - min; double[] ret = new double[224 * 65]; for (int i = 0; i < ret.length; i++) { ret[i] = del * RND.nextDouble() + min; return ret; |
String | randomIcon() random Icon int min = 1, max = 24; return String.format("https://coding.net/static/project_icon/scenery-%d.png", min + (int) (Math.random() * ((max - min) + 1))); |
String | randomID() Generate a random ID. return System.currentTimeMillis() + ""; |
String | randomId() Create and return an ID that's (virtually) guaranteed not to name a real object on a GA4GH server. return UUID.randomUUID().toString();
|
int[] | randomIndices(Random r, int minCount, int maxCount) random Indices minCount = Math.max(Math.min(minCount, maxCount), 1); maxCount = Math.max(minCount, maxCount); List<Integer> tmp = new ArrayList<>(maxCount); for (int i = 0; i < maxCount; i++) { tmp.add(i); Collections.shuffle(tmp); final int outputCount = minCount + r.nextInt(maxCount - minCount); ... |