On Thu, 22 Oct 2026 11:43:02 -0400
Greg Wooledge <[email protected]> wrote:

> 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).

Another way to prevent repetition is to delete each element from the
array when you play it. This is easy enough to code, but does prevent
you from backtracking.

Another way to get your playlist played randomly and non-repeatably is
to use vlc and have it play randomly within the playlist. I suspect
other players can do similarly.

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/

Reply via email to