I have the following code to generate a random number. However if i leave the txtNumberSeed field the same, and run the method multiple times, it brings back the same random number. Any Help, Thanks!!!
public void seedRandomGenerator(){
try{
long seedNumber = Long.parseLong(txtNumberSeed.getText());
Random random = new Random(seedNumber);
randomNumber = 1 + random.nextInt(nameCounter-1);
System.out.print(randomNumber);
JOptionPane.showMessageDialog(null,"New Seed Value in use","Error",JOptionPane.INFORMATION_MESSAGE); txtNumberSeed.setText(""
;
}
catch(IllegalArgumentException illegalArgumentException){
JOptionPane.showMessageDialog(null,"Please input a Random Seed Value","Error",JOptionPane.INFORMATION_MESSAGE); }
}
public void seedRandomGenerator(){
try{
long seedNumber = Long.parseLong(txtNumberSeed.getText());
Random random = new Random(seedNumber);
randomNumber = 1 + random.nextInt(nameCounter-1);
System.out.print(randomNumber);
JOptionPane.showMessageDialog(null,"New Seed Value in use","Error",JOptionPane.INFORMATION_MESSAGE); txtNumberSeed.setText(""
}
catch(IllegalArgumentException illegalArgumentException){
JOptionPane.showMessageDialog(null,"Please input a Random Seed Value","Error",JOptionPane.INFORMATION_MESSAGE); }
}