title: Generating Unique Set of Random Integers
body: <p>This is my first time building an app and I have a problem. I'm making this app that will generate random numbers only sometimes it shows me the number twice. This is not what I'm aiming for so how can program it that it will show random numbers without duplicates?</p>
  
  <p>This is my code btw:</p>
  
  <pre><code>    package rando.mizer;
  
      import java.util.Random;
  
      import android.app.Activity;
      import android.os.Bundle;
      import android.view.View;
      import android.widget.Button;
      import android.widget.EditText;
  
      public class RandomizerFinalActivity extends Activity {
          /** Called when the activity is first created. */   
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
              Button buttonGenerate = (Button)findViewById(R.id.button1);
              final EditText aantalT= (EditText)findViewById(R.id.editText1);
              final EditText laagsteT = (EditText)findViewById(R.id.editText2);
              final EditText hoogsteT = (EditText)findViewById(R.id.editText3);
              final EditText uitvoerT = (EditText)findViewById(R.id.editText4); 
  
  
  
              buttonGenerate.setOnClickListener(new Button.OnClickListener(){
  
                 public void onClick(View arg0) {
                      final int aantal = Integer.parseInt(aantalT.getText().toString());
                      final int laagste = Integer.parseInt(laagsteT.getText().toString());
                      final int hoogste = Integer.parseInt(hoogsteT.getText().toString());
  
                      uitvoerT.setText("");
                      Random r = new Random();
  
                      int aNumber;
                      String build = "";
  
  
                  for(int i = 0; i &lt; aantal; i++) {
                      aNumber = laagste + r.nextInt(hoogste + 1 - laagste);
                      build += aNumber + ",\n";
                  }
  
                      uitvoerT.setText(build);
  
  
                }
  
              });
          }
      }
  </code></pre>