改成这样
那句if就不要他了
for(int i=0; i<10;i++) {
     x=rand.nextInt(200);
     x += 100;
     ta.append(""+x+"\n");
      
     }

解决方案 »

  1.   

    或者这样。
    x=100+(int)(Math.random()*10000)/200;
      

  2.   

    import java.awt.*;
    import java.util.Random;
    import java.awt.event.*;public class Temp extends Frame {
      public static void main(String args[]) {
        Temp test = new Temp();
        TextArea ta = new TextArea();    test.add(ta, BorderLayout.CENTER);
        Random rand = new Random();
        int x;
        for (int i = 0; i < 10; i++) {
          x = rand.nextInt(200) + 100;
          ta.append("" + x + "\n");
        }    test.setSize(300, 200);
        test.setVisible(true);
        test.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
    System.exit(0);
          }
        });
      }
    }