java - Quick call to generate array containing number from 0 to N -
simple question here -- apis.
i want iterate through array in random order.
it easy enough to:
- fill list numbers 0 n
- shuffle list collections.shuffle
- use shuffled list guide array iteration.
however, wondering if step 1 (generating list of numbers 0 n) exists somewhere in prewritten code.
for instance, convenience method in guava's xyz class??
the closest thing in guava be
contiguousset.create(range.closedopen(0, n), discretedomains.integers())
...but, frankly, is more readable write for
loop yourself.
Comments
Post a Comment