• Zarobi@aussie.zone
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 days ago
    def getNextShuffle(songs):
        return random.choice(songs)
    

    Vs

    def getNextShuffle(songs):
        randList = random.sample(songs, k=len(songs))
        for song in randList:
            yield song
    

    Didn’t include persisting it to storage for brevity. Only tricky part would be detecting when the source playlist changes and how to handle that. Personally I’d just append any new songs to a random position in the unplayed portion, while removal is obviously simple