Quick call to generate array containing number from 0 to N
Simple question here -- mostly about APIs.
I want to iterate through an array in random order.
It is easy enough to:
fill a List with the numbers 0 to N
shuffle the List with Collections.shuffle
Use this shuffled list to guide my array iteration.
However, I was wondering if step 1 (generating the list of numbers from 0
to N) exists somewhere in prewritten code.
For instance, could it be a convenience method in guava's XYZ class??
No comments:
Post a Comment