title: How to randomize enum elements?
body: <p>Say you have an <code>enum</code> with some elements</p>
  
  <pre><code>public enum LightColor {
     RED, YELLOW, GREEN
  }
  </code></pre>
  
  <p>And would like to randomly pick any color from it.</p>
  
  <p>I put colors into a</p>
  
  <pre><code>public List&lt;LightColor&gt; lightColorChoices = new ArrayList&lt;LightColor&gt;();
  
  lightColorChoices.add(LightColor.GREEN);
  lightColorChoices.add(LightColor.YELLOW);
  lightColorChoices.add(LightColor.RED);
  </code></pre>
  
  <p>And then picked a random color like:</p>
  
  <pre><code>this.lightColor = lightColorChoices.get((int) (Math.random() * 3));
  </code></pre>
  
  <p>All of this (while working fine) seems needlessly complicated. Is there a simplier way to pick a random enum element?</p>