title: Get a random subset from a result set in java
body: <p>I have a set of 100 object.
  How can i get a subset of 5 objects from this set ?</p>
  
  <p>I'm doing this for now but it only returns me one object</p>
  
  <pre><code>          int size = memberSet.size();
        Set&lt;Member&gt; randomSet = new HashSet&lt;Member&gt;();
              int item = new Random().nextInt(size);
              int i = 0;
              for(Member mbr : memberSet)
              {
                  if (i == item){
                      randomSet.add(mbr);
              }
                  i = i + 1;
              }
  </code></pre>