예제 #1
0
 public void genSeed(ActionEvent e) {
   long seed = 0;
   boolean redo = false;
   do {
     redo = false;
     String seedString =
         JOptionPane.showInputDialog(
             this, "Enter a number:", Long.toString(rand.nextLong(), 36)
             // "Random Seed", JOptionPane.QUESTION_MESSAGE
             );
     if (seedString == null) return;
     try {
       seed = Long.parseLong(seedString, 36);
     } catch (NumberFormatException ex) {
       JOptionPane.showMessageDialog(this, "Use only letters and numbers, max 12 characters.");
       redo = true;
     }
   } while (redo);
   genSeed(seed);
 }
예제 #2
0
 public void genRandom() {
   genSeed(rand.nextLong());
 }