Java Random randomIntArray(int len, Random rand)

Here you can find the source of randomIntArray(int len, Random rand)

Description

random Int Array

License

BSD License

Declaration

public static int[] randomIntArray(int len, Random rand) 

Method Source Code


//package com.java2s;
//License from project: BSD License 

import java.util.*;

public class Main {
    public static int[] randomIntArray(int len, Random rand) {
        int[] out = new int[len];
        for (int i = 0; i < len; i++) {
            out[i] = rand.nextInt();/*from  w w w .  j a  va2  s .c  o m*/
            if (out[i] < 0)
                out[i] = -out[i];
        }
        return out;
    }
}

Related

  1. randomID()
  2. randomId()
  3. randomIndices(Random r, int minCount, int maxCount)
  4. randomInRange(double min, double max)
  5. randomInsults()
  6. randomIntegerList(int sz, int min, int max)
  7. randomIntegers(int sz)
  8. randomIterable(Collection col)
  9. randomKey()