Q:

Avoid generating random integer in different functions

My function:
public int[] generateRandomInteger(){
    int[] arr = new int[100];
    Random randomGenerator = new Random();

    for (int i = 0; i < 100; i++){
        int randomInt = randomGenerator.nextInt(16) + 10;
        arr[i] = randomInt;
    }        
    return arr;
}

The problem is: when I use arr in another function, it will generate a different array of 100 integer numbers. How can I avoid this problem ? I only want to use exactly the array that generate from the function above.
Any help would be appriciated !

A:

If you want to have arr variable to be common to all objects.Then use static variable.  
static int[] arr = new int[100];
public void setRandomIntegerArray(){
  Random randomGenerator = new Random();
  for (int i = 0; i < 100; i++){
      int randomInt = randomGenerator.nextInt(16) + 10;
      arr[i] = randomInt;
  }
}
public int[] getRandomIntegerArray(){
    return arr;
}

If you want to have arr variable to be separate for each object.Then use instance variable.  
int[] arr = new int[100];
public void setRandomIntegerArray(){
  Random randomGenerator = new Random();
  for (int i = 0; i < 100; i++){
      int randomInt = randomGenerator.nextInt(16) + 10;
      arr[i] = randomInt;
  }
}
public int[] getRandomIntegerArray(){
    return arr;
}

