title: Generating a random enum value continuously without getting the same value twice
body: <p>I have a enum Teams that I want to randomise. So i have:</p>
  
  <pre><code>public enum Teams { TEAM1, TEAM2, TEAM3, TEAM4, TEAM5, TEAM6; }
  </code></pre>
  
  <p>I then have a random method to generate the value randomly:</p>
  
  <pre><code>public static Teams getRandomTeam() {
      return Teams.values()[(int) (Math.random() * Teams.values().length)];
  }
  </code></pre>
  
  <p>Which does return a randomly generated team, however I need, once a team is generated, say TEAM2, it cannot be generated again.</p>
  
  <p>I'm using:</p>
  
  <pre><code>System.out.println("The team is " + getRandomTeam());
  System.out.println("The team is " + getRandomTeam());
  System.out.println("The team is " + getRandomTeam());
  System.out.println("The team is " + getRandomTeam());
  System.out.println("The team is " + getRandomTeam());
  System.out.println("The team is " + getRandomTeam());
  </code></pre>
  
  <p>(which I know is wrong because it's calling the method over and over.</p>
  
  <p>At the minute when I run the program the out put could be:</p>
  
  <p>The team is: TEAM2</p>
  
  <p>The team is: TEAM2</p>
  
  <p>The team is: TEAM4</p>
  
  <p>The team is: TEAM2</p>
  
  <p>The team is: TEAM3</p>
  
  <p>The team is: TEAM2</p>
  
  <p>But I need my program to output the an enum value once and once only.
  Thanks</p>