in reply to Re: Add a fixed number of unique elements to hash
in thread Add a fixed number of unique elements to hash
If shuffle takes too long you could do this:
sub uploadPlaylist { for my $i ( 1 .. $numOfRandFiles ) { $playList{ splice @audioFiles, int rand @audioFiles, 1 } = $i; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Add a fixed number of unique elements to hash
by Vasek (Acolyte) on Mar 05, 2023 at 22:55 UTC |