You have a syntax error. boxCount has not been instantiated and is not a known type. You need to create the boxCount array before you attempt to use it. See example below:

public void shoes(int[] pairs)
{
    System.out.println("We will roll go through the boxes 100 times and store the input for the variables");
    int boxCount[] = new int[100];
    for(int i=0; i < boxCount.length; i++)
    {
        //("Random Number ["+ (i+1) + "] : " + (int)(Math.random()*6));
        boxCount[i]  =  (int) (Math.random()*6) + 1;
    }
}
Answer from cklab on Stack Overflow
🌐
Programiz
programiz.com › java-programming › library › math › random
Java Math.random()
// get random array index int random = (int)(Math.random() * range) + lowerBound; System.out.print(array[random] + ", "); } } }
🌐
TutorialsPoint
tutorialspoint.com › generate-a-random-array-of-integers-in-java
Generate a random array of integers in Java
September 12, 2023 - Here we use the nextInt() method in a loop to get a random integer for each element. for (int i = 0; i < arr.length; i++) arr[i] = rd.nextInt(); Anvi Jain · Updated on: 2023-09-12T03:29:56+05:30 · 40K+ Views · Java - Math random() method Java ·
🌐
Coderanch
coderanch.com › t › 634777 › java › int-index-int-Math-random
int index = (int)(Math.random() * array.length); (Beginning Java forum at Coderanch)
June 6, 2014 - If you find the code for the Math.java class, which is in the src.zip file in your Java® installation folder, you will find that the Math#random method uses a Random object behind the scenes. ... The right-hand of the assignment statement is randomly choosing a position from the array and assigning it to the variable 'index'.
🌐
Scaler
scaler.com › home › topics › java math random() method
Java Math random() Method- Scaler Topics
November 30, 2024 - As clearly visible in the output below, we obtain five random numbers from the array provided : ... The Math.random method in Java provides random numerical values when it is called.
🌐
Baeldung
baeldung.com › home › java › java array › how to fill an array with random numbers
How to Fill an Array With Random Numbers - Java
August 13, 2024 - int[] arr = new int[ARRAY_SIZE]; ... We can generate random numbers using the ints(), longs(), and doubles() methods added to the pseudo-random number classes in Java 8 and above....
🌐
JavaBeat
javabeat.net › home › how to use math.random() in java
How to Use Math.random() in Java
September 27, 2024 - Doing this will fetch the random elements from the input array, which we print on the console using println(): “Math.random()” is not the only way of generating random numbers in Java, instead we have some other alternatives available that are discussed below:
Find elsewhere
🌐
Baeldung
baeldung.com › home › java › java numbers › generating random numbers in a range in java
Generating Random Numbers in a Range in Java | Baeldung
May 11, 2024 - Generate Bounded and Unbounded Random Strings using plain Java and the Apache Commons Lang library. ... Math.random gives a random double value that is greater than or equal to 0.0 and less than 1.0.
🌐
GeeksforGeeks
geeksforgeeks.org › java › add-random-number-to-an-array-in-java
How to Add Random Number to an Array in Java? - GeeksforGeeks
July 23, 2025 - ... // Java Program to Add Random ... main(String[] args) { int n = 5; int[] arr = new int[n]; // Create a Random object Random random = new Random(); // Assign random values to the array for (int i = 0; i < n; i++) { // Generate a ...
🌐
W3Schools
w3schools.com › java › ref_math_random.asp
Java Math random() Method
Strings Concatenation Numbers and ... Java Math Java Booleans · Booleans Real-Life Example Code Challenge Java If...Else · if else else if Short Hand If...Else Nested If Logical Operators Real-Life Examples Code Challenge Java Switch ... For Loop Nested Loops For-Each Loop Real-Life Examples Code Challenge Java Break/Continue Java Arrays...
🌐
TutorialsPoint
tutorialspoint.com › article › java-program-to-generate-a-random-number-from-an-array
Java program to generate a random number from an array
November 4, 2024 - In this article, we will learn how to generate a random number from an array of integers in Java by using Random class. The Random class provides methods to generate random numbers, and we will use the nextInt(int bound) method to get a random index
🌐
Coderanch
coderanch.com › t › 688929 › java › Fill-array-random-numbers
Fill an array with random numbers (Beginning Java forum at Coderanch)
September 10, 2014 - Junilu Lacar wrote: What you're trying to get is a random value for k, which will be a number from 0 to 9999 since your array A has 10000 elements. Then how am I supposed to do that??? ... John Kapas wrote: So, you mean for the random position is A[k] = math.Random () * 9999?
🌐
CodeJava
codejava.net › coding › how-to-generate-random-numbers-in-java
How to generate random numbers in Java
It calls the nextDouble() method ... pseudorandom numbers in various formats like integer, double, long, float, boolean and you can even generate an array of random bytes....
🌐
Quora
quora.com › How-can-I-randomize-an-array-in-Java
How to randomize an array in Java - Quora
If the array is already filled I can see two methods ( assuming you do not want to use the shuffle() method on type List 1. Create an ArrayList of objects of the type in the array.
🌐
Javatpoint
javatpoint.com › java-math-random-method
Java Math.random() Method
Java Math.random() Method with Examples on abs(), min(), max(), avg(), round(), ceil(), floor(), pow(), sqrt(), sin(), cos(), tan(), exp() etc.
🌐
CodeGym
codegym.cc › java blog › java math › java math random() method
Java Math random() Method
December 5, 2024 - To get a random number within a range, you need to calculate the range by subtracting min from max. Then after taking a product of range with the Math.rand() you need to add the min number.