List of utility methods to do Random
String | getRandomUUID() get Random UUID UUID uuid = UUID.randomUUID();
return uuid.toString();
|
boolean | isRandomList(List> list) is Random List return (list instanceof RandomAccess); |
Integer | medianHelper(List median Helper Integer pivot; int numPivots = 0; List<Integer> less, greater; ListIterator<Integer> iter; if (list.size() == 1) { return list.get(0); less = new LinkedList<Integer>(); ... |
int | multSample(Random rng, double[] vals, double normsum) Draw a multinomial sample from (un-normalized) vals double rval = rng.nextDouble() * normsum; double cumsum = 0; int j = 0; while (cumsum < rval || j == 0) { cumsum += vals[j]; j++; return j - 1; ... |
void | permute(Object[] arr, Random random) Fischer-Yates shuffling algorithm for permuting the contents of a coordinate array. for (int i = arr.length - 1; i > 0; i--) { int j = random.nextInt(i + 1); swap(arr, i, j); |
int | rand() pseudo-random number based on linear congruential method holdrand_ = holdrand_ * 214013L + 2531011L; return (int) ((holdrand_ >> 16) & 0x7fff); |
float | Rand() Rand final float ra; ra = (float) (Math.random() - 0.5); return (ra); |
float | randAngle() rand Angle return (float) (Math.random() * 2.0 * Math.PI); |
float | randFloat(float min, float max) rand Float return (float) (min + Math.random() * ((1 + max) - min)); |
double | random() random return Math.random();
|