Drawing a given number of random objects from a collection

Is there a simple way to draw a given number of random objects from a collection in Java?

The best I could come up with was...

Take the collection and put it in an arraylist.

shuffle the arraylist

Use the first n objects.

Is there an easier way that I am not thinking about?

[311 byte] By [khandes3a] at [2007-11-27 10:37:22]
# 1

That is indeed the easiest way.

dwga at 2007-7-28 18:47:39 > top of Java-index,Core,Core APIs...