in reply to Updating sub for random number generation
update: fixed confusing (and wrong) mix of array and array-refs.@array_of_items = [ ... get items from database ]; print map { $array_of_items[$_ -1] } random_subset_X(scalar(@array_of_ +items), $count);
update 2: subtract from index, since output values are 1 .. max instead of 0 .. max -1.
|
|---|