List of utility methods to do Random
short | random_g729() randog return (short) (0xFFFF & System.currentTimeMillis()); |
short | random_g729() Return random short. seed = (short) (seed * 31821L + 13849L); return (seed); |
int | randomAgain() random Again int r = (int) (58 * Math.random() + 65); if (r > 90 && r < 97) { return randomAgain(); return r; |
char | randomAlpha() Generate a random character from the alphabet - either a-z or A-Z int i = (int) (Math.random() * 52); if (i > 25) return (char) (97 + i - 26); else return (char) (65 + i); |
char | randomAlternate(char c) random Alternate int idx = letterList.indexOf(c); return letters[(idx + rand.nextInt(letters.length - 1) + 1) % letters.length]; |
char[] | randomCharacterVector(int size) Creates a random vector of chars of length size. char[] retVal = new char[size]; for (int i = 0; i < size; i++) { retVal[i] = (char) ('A' + random.nextInt((int) ('Z' - 'A'))); return retVal; |
String | RandomCode() Random Code StringBuffer str = new StringBuffer(); str.append((int) (Math.random() * 9 + 1)); for (int i = 0; i < 5; i++) { str.append((int) (Math.random() * 10)); return str.toString(); |
String | randomCode() random Code int code = (int) (Math.random() * 1000); if (code < 10) { return "00" + code; } else if (code < 100) { return "0" + code; } else { return "" + code; |
Long | randomCSeq() Generates a random long number int cseq = (new Random()).nextInt(); if (cseq < 0) cseq = -cseq; return new Long(cseq); |
byte[] | randomData(Random random, int length) random Data byte[] data = new byte[length]; random.nextBytes(data); return data; |