Java Utililty Methods Random Int

List of utility methods to do Random Int

Description

The list of methods to do Random Int are organized into topic(s).

Method

StringrandomWord(int wordLength)
random Word
StringBuffer word = new StringBuffer();
for (int i = 0; i < wordLength; i++) {
    int index = Math.abs((int) (Math.random() * WORD.length()));
    char ch = WORD.charAt(index);
    word.append(ch);
return word.toString();
StringrandomZeroString(int length)
random Zero String
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
    sb.append("0");
return sb.toString();
intrandowPartition(int[] array, int q, int p)
randow Partition
int pivotIndex = q + (int) Math.round((p - q - 1) * Math.random());
int pivot = array[pivotIndex];
int[] leftArray = new int[p - q + 1];
int[] rightArray = new int[p - q + 1];
int ll = 0, rl = 0;
for (int i = q; i < p; i++) {
    if (array[i] <= pivot && i != pivotIndex) {
        leftArray[ll] = array[i];
...
int[]randProductNumerid(final int c, final int count)
rand Product Numerid
int ret[] = new int[c];
int i = 0;
while (true) {
    if (i == c) {
        break;
    int a = (int) Math.ceil(Math.random() * count);
    if (!isExist(a, ret)) {
...
intRandSelect(int iTotal)
Rand Select
double a;
a = Math.random();
a = a * iTotal;
return ((int) a);