On Thu, Oct 22, 2026 at 15:34:59 -0000, CGS wrote:
If I select random on a finite song playlist, I wouldn't want the
same song playing twice; this would require an algorithm that would deselect songs that have already been chosen. Maybe your code
accounted for that (or not).
This is covered by keeping track of what's already been selected,
either in a second array (which is the more efficient way), or by
traversing the playlist to see if the new selection is already in
the playlist (the less efficient way).
$ echo {1..10}
, the 'for i in {1..10}; do' is exactly equivalent to 'for i in 1 2 3 4
5 6 7 8 9 10 ; do'.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 5 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 498677:20:29 |
| Calls: | 212 |
| Calls today: | 3 |
| Files: | 910 |
| D/L today: |
31 files (22,593K bytes) |
| Messages: | 69,826 |