Here you can find the source of randProductNumerid(final int c, final int count)
public static int[] randProductNumerid(final int c, final int count)
//package com.java2s; public class Main { public static int[] randProductNumerid(final int c, final int count) { int ret[] = new int[c]; int i = 0; while (true) { if (i == c) { break; }/*from w w w .j a v a 2s .c om*/ int a = (int) Math.ceil(Math.random() * count); if (!isExist(a, ret)) { ret[i++] = a; } } return ret; } private static boolean isExist(final int a, final int[] ints) { boolean ret = false; for (int i = 0; i < ints.length; i++) { if (a == ints[i]) { ret = true; break; } } return ret; } }