ho fatto il seguente codice e vorrei estrarre numeri casuali ma al momento non conosco il comando per la casualità quindi ho fatto così.

public class EstrazioneNumeri {
private int numeriDisponibili;
public EstrazioneNumeri() {
numeriDisponibili = 10;

}
public void estrai() throws EstrazioneException{
if( numeriDisponibili == 10) {
throw new EstrazioneException();
}
numeriDisponibili++;
}

}
-------------------------
public class EstrazioneException extends Exception {
public EstrazioneException() {
super("Problema con l'estrazione");
try {
int numeriDisponibili;
if(numeriDisponibili == 10) {
throw new EstrazioneException();
}
numeriDisponibili++;
}
catch (EstrazioneException exc){ // qui mi dice di insserire } ma non riesco a capire dove... se la metto alla fine mi dà altri errori...
System.out.println(exc.toString());
}
public String toString() {
return getMessage()+": numeri esauriti!!!";
}
}
------------------


public class GestoreEstrazione {

public static void main(String[] args) {
EstrazioneNumeri estrazione = new EstrazioneNumeri();
try{
for (int i = 1; i <= 10; ++i) {
estrazione.estrai();
System.out.println("Estratto numero: "+i);
}
}catch (EstrazioneException exc) {
System.out.println(exc.toString());
}
}

}