Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generate numVals random integers in the range 0 - maxVal, inclusive.
- // Record in the count array at index k the number of times that k occurs
- // as one of the random integers.
- private static void genCounts(int numVals, int[] count) {
- int idx;
- for(int k = 0; k < numVals; k++) {
- //count[k] = (int)(Math.random() * (maxVal + 1));
- idx = (int)(Math.random() * (maxVal + 1));
- count[idx]++;
- }
- } // genCounts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement