I want this program to bring back a new set of numbers every time the 'Generate Number' button is clicked, that is 6 integer numbers between 0 and 10.
However, it brings back the same set of numbers even after clicking the button again and again.
This is the Model class code that generates the number:
public class Number {
int[] num = new int[6];
Random ran = new Random(10);
public int[] generate(){
for(int i = 0; i<6; i++)
{
num[i] = ran.nextInt(10);
}
return num;
}
}
and this is how this code gets called from the ActionListener
method:
public void actionPerformed(ActionEvent e) {
Number numb = new Number();
lot_num.setText(Arrays.toString(numb.generate()));
}
I also can't tell how to manage the format of the result so that it is spaced through the text field without the commas and the brackets.