Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
translations translations
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  Shuffle
« previous next »
  • Print
Pages: [1]

Author Topic: Shuffle  (Read 201 times)

Offline SoloBSD

  • Member
  • *
  • Posts: 4
Shuffle
« on: April 09, 2025, 02:27:15 PM »
Has anyone noticed that the shuffle of songs is not as random?

I have like 8,000 songs and when I use "shuffle" on all songs, it goes (example):
- Beatles song
- Beatles song
- Nirvana song
- Beatles song
- Metallica song
- Metallica song
- Beatles song
- Beatles song
- Kiss song
- Beatles song
- Metallica song

Even when I have many "Artists" songs, seems is not as random as I wanted to be, or expected to be.
Is there a way to make it more random?

I'm using a HiFi Walker H2
256 SD
Logged

Offline rockbox_dev123

  • Member
  • *
  • Posts: 165
Re: Shuffle
« Reply #1 on: April 09, 2025, 03:17:23 PM »
I'll likely get corrected by someone more knowledgeable, but it's my understanding that true randomness is a "hard" computer science task. I don't believe there are any good entropy sources for Rockbox to use. I'm not sure what seed Rockbox is using for srand (or if it's even using srand) but it should be fairly easy to poke into the code.

For what it's worth I have had the same tracks come up frequently enough with Rockbox to notice. Even with a shuffled playlist of 90,000+ tracks.

The same thing (getting the same tracks from shuffle) also happens when I play the same playlist with Audacious on a PC.

Maybe add some more music/diversity to your library? ;)

EDIT:
The shuffle is handled by randomise_playlist_unlocked and uses current_tick as the seed.

« Last Edit: April 09, 2025, 03:25:09 PM by rockbox_dev123 »
Logged

Offline gevaerts

  • Developer
  • Member
  • *
  • Posts: 1076
Re: Shuffle
« Reply #2 on: April 11, 2025, 10:06:33 AM »
A random shuffle means you *can* get adjacent "related" tracks, as excluding those wouldn't be random at all (you *can* get ten heads in a row when flipping coins!).

Other software sometimes has shuffling mechanics that are deliberately less random to make human brains think they're more random, rockbox does not.
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 1194
Re: Shuffle
« Reply #3 on: April 11, 2025, 12:19:17 PM »
This article touches on the topic gevaerts is talking about

Random Doesn't Feel Random
https://www.howtogeek.com/847793/why-spotify-shuffle-is-not-truly-random/#random-doesn-t-feel-random

Prior to 2014 at least spotify used the same method for randomness.
Quote
until 2014, this was how the shuffle feature worked, but people complained that it wasn't random enough. So, Spotify changed it up.

(by making it less random)

If we were to implement something like what Spotify has now we would have to add a lot of extra logic and keep state
(that might be as easy as looking back over the already generated entries) but keeping that state costs processing time and or RAM which might work for a small playlist but gets crazy (and slow) when dealing with 1000's of tracks

Some related links mentioned in that post
https://web.archive.org/web/20250103102558/https://engineering.atspotify.com/2014/02/how-to-shuffle-songs/

http://keyj.emphy.de/balanced-shuffle/
« Last Edit: April 11, 2025, 12:35:47 PM by Bilgus »
Logged

Offline Frankenpod

  • Member
  • *
  • Posts: 798
Re: Shuffle
« Reply #4 on: April 12, 2025, 04:27:38 AM »
Just wondering what the exact nature of the OP's issue is.  Are they saying they want a randomly-selected artist, then a random song by that artist, rather than just a randomly-selected track (that is likely to be by an artist that has more tracks present in the library?).

If that's the issue, it's presumably solvable in theory, though probably the demand for it isn't enough for anyone to implement it, assuming the OP isn't able to themselves?
Logged

Offline SoloBSD

  • Member
  • *
  • Posts: 4
Re: Shuffle
« Reply #5 on: April 12, 2025, 03:52:05 PM »
Is not an issue per se, I just wanted more randomness on choosing the next song.

I have around 8,000 songs on my device.
 - Around 442 artists (so I think I have enough diversity of artists)
 - Around 900 albums
 
I am checking my Music now and yes, most of those 442 have max 5 songs each, while The Beatles have around 1,000 songs, Nirvana around 900, Megadeth and Metallica around 500 each, so I think this time random wins against me.

Thanks all!
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  Shuffle
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.162 seconds with 22 queries.