title: How to get 100 random elements from HashSet in Java?
body: <p>I have a HashSet in which I have 10000 elements. I want to extract random 100 elements from that HashSet. So I thought I can use shuffle on the set but it doesn't work.</p>
  
  <pre><code>Set&lt;String&gt; users = new HashSet&lt;String&gt;();
  
  // for randomness, but this doesn't work
  Collections.shuffle(users, new Random(System.nanoTime()));  
  
  // and use for loop to get 100 elements
  </code></pre>
  
  <p>I cannot use shuffle now, is there any other best way to get 100 random elements from HashSet in Java?</p>