(self)
Assigns a random index to every song in the queue.
Assigns a random index to every song in the queue.
Assigns a random index to every song in the queue .
def shuffle(self) -> None:
        """Assigns a random index to every song in the queue."""
        indices = list(range(1, self.count() + 1))
        random.shuffle(indices)
        for song, index in zip(self.all(), indices):
            song.index = index
            song.save()
def shuffle ( self ) -> None : indices = list ( range ( 1 , self . count ( ) + 1 ) ) random . shuffle ( indices ) for song , index in zip ( self . all ( ) , indices ) : song . index = index song . save ( )