Random Playlists not random...again

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
slackard
New Cone
New Cone
Posts: 3
Joined: 22 Jul 2010 07:59

Random Playlists not random...again

Postby slackard » 18 May 2011 17:11

In VLC settings I've specified 'play all tracks randomly forever' and when vlc starts the Random/shuffle button is illuminated (random playback on)..... However....

I have large playlist with 1000+ items. Every time I start vlc by double clicking the playlist.xspf on my desktop, the very first file in the playlist is played, and every subsequent track is played in the exact same order i.e. NOT random.

This issue has existed and been repaired in previous versions of vlc but it seems like every time I reformat my system and install a new version the same issue is revived in the latest version.. I don't understand how a bug can be fixed in one version then re-introduced with the exact same behavior 1 or 2 or 3 versions later.

Issue was identified with track item 3932 about a year ago, and was flagged as fixed.. (https://trac.videolan.org/vlc/ticket/3932)
Fraid not.

slackard
New Cone
New Cone
Posts: 3
Joined: 22 Jul 2010 07:59

Re: Random Playlists not random...again

Postby slackard » 18 May 2011 17:45

follow-up.

Impacted system is win 7x64, vlc v1.1.1.9

another system, not affected, win7x64, vlc v1.1.1.6

DigitalMonk
New Cone
New Cone
Posts: 1
Joined: 21 Jun 2011 23:42

Re: Random Playlists not random...again

Postby DigitalMonk » 22 Jun 2011 00:01

I'm not entirely certain why this is so hard, but I (and many, many people around the web) agree. The most miraculous thing to me is that "play files randomly forever" is the _ONLY_ mode I ever want VLC to use for my music, and yet I have never managed to get a version of VLC that can do that sanely (though I've read that specific point releases did manage to get it right until somebody reverted the change).

Point 1 -- Why is it "random" the same way every time?
I strongly suspect that whoever is shuffling is just using rand() from the C runtimes. That is "random enough", assuming that you bother to seed the generator with srand(). If not, the seed will always be the same (zero, I believe), so the shuffle will always be the same.

As an example: http://www.cplusplus.com/reference/clib ... dlib/rand/

The critical part there is simply:

Code: Select all

/* initialize random seed: */ srand ( time(NULL) );
Point 2 -- But when it repeats, it plays the songs in the same order as before!
VLC appears to only shuffle the playlist once, and then repeat that shuffled playlist indefinitely. It's not particularly hard to fix that::

1. Load playlist
2. Shuffle playlist (like a deck of cards -- randomly pick two indices and swap them, repeat a lot)
3. Play playlist
4. When you reach the end of the playlist, if you are supposed to play forever, goto step #2 (as opposed to what VLC appears to do, which is "goto step #3")

It is possible to get a repeat when you reach step 4 and jump to step 2. Personally, I don't think it's worth trying to fix that, because if you've got 100+ songs, the likelihood is pretty low... But I'm sure somebody will complain that "every so often I get a song repeated really close together."

Point 3 -- But I can't stand any repeats!
You can protect against that with a few more steps, though this introduces a different structure (which hopefully won't stand out for large playlists):

1. Load playlist
2. Shuffle entire playlist (breaks up sequencing -- will discuss after algorithm)
3. Shuffle front half of playlist (will make sense when we hit the loop)
4. Play front half of playlist
5. Shuffle back half of playlist
6. Play back half of playlist
7. If repeating, goto step #3

Step #2 may seem irrelevant, but if you don't do it, you get (for example) all your artists named A-M playing together and all of them named N-Z playing together. So we do one quick shuffle up front, and then we shuffle+play the halves. It is now impossible to have a song repeat in less than half the playlist length, which is the most you can possibly hope for. If you want longer spans between repeats, then you basically have to do what VLC does now, which is build up one mix-playlist and just keep repeating it. That doesn't work for me, 'coz my subconscious learns the mixed ordering and starts pre-playing music before it actually starts. That's why I'm kind of a stickler for reasonable and sane shuffling...

trillian59
New Cone
New Cone
Posts: 8
Joined: 11 Oct 2011 09:44

Re: Random Playlists not random...again

Postby trillian59 » 11 Oct 2011 09:54

I second the problem. I start VLC from an Icon and let it play a directory randomly. The sequence is mostly the same all the time (it seems to change once per month or so, very strange).

This becomes a bit boring and I also ask to add "srand(time(NULL))" right at the beginning of the program. PLEEEAAASSSE!

Update: the change is NOT "once" a month, but its just dependened on the numbers of files in the playlist (so I acutally I guess the random sequence generated is really always the same)

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Random Playlists not random...again

Postby VLC_help » 11 Oct 2011 16:26

Random seems to work in VLC 1.1.11

trillian59
New Cone
New Cone
Posts: 8
Joined: 11 Oct 2011 09:44

Re: Random Playlists not random...again

Postby trillian59 » 11 Oct 2011 17:18

Random seems to work in VLC 1.1.11
Yuck! hmm, I just tested it on a different computer, there it works... :shock:

"vlc -Z <dir>" (or "vlc --random <dir>) produces a different list each time.

BUT! :!: I still have 2 computers here on which the same command every time plays the same song (and sequence)

(btw, its always the same dir, its a network share)

WHAT the heck is this???

this is reproducable, so what could this be??? (all comps running W7-64 with 4,8,or 16 Gb of mem, cpu is AMD Athlon (2,4 and 6 cores))... 2 and 4 core play the same all the time, 6 core plays random. Is there a special need for stepping level or so????

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Random Playlists not random...again

Postby VLC_help » 12 Oct 2011 16:27

Does it matter if you copy that network folder to local drive and playback it?

trillian59
New Cone
New Cone
Posts: 8
Joined: 11 Oct 2011 09:44

Re: Random Playlists not random...again

Postby trillian59 » 12 Oct 2011 18:08

Does it matter if you copy that network folder to local drive and playback it?
no, so far nothing helped on these 2 machines (in between I have tested some more computers in the LAN, 8 work ok, only these 2 fail to randomize)

This is really wierd.

The sequence only changes if the content of the folder changes (add/delete files).

Also, the machines are rather "pure", no special software installed (I was thinking about some debuggers that would allow to freeze the srand() library function to generate the same sequence all the time, I knew it once existed on some unix systems. But windows?, and, as I said, there is nothing special installed)

(Dont laugh, but the machine that really made me write this bugreport is located in my gym and the only use of the computer is to backup the servers and to random play with vlc while I am sweating :D So I noticed the problem very fast)

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Random Playlists not random...again

Postby VLC_help » 13 Oct 2011 15:56

Does same happen if you save the playlist, and use it as input?

trillian59
New Cone
New Cone
Posts: 8
Joined: 11 Oct 2011 09:44

Re: Random Playlists not random...again

Postby trillian59 » 13 Oct 2011 19:46

Does same happen if you save the playlist, and use it as input?
Just tested (lol, never saved a playlist before, but it was easy :D ) YES, its the same (and always too) sequence than giving the directory.


Lol, the playlist is about 800k in size.. getting curious, whats in there besides some pathnames? have to look..


Anyway, nothing changed, still always the same sequence :( SNIFF!

UPDATE: I just tried something else on the machine, changing the user. Logged in as the global Admin, IT WORKS, back to the original User (local Admin of that machine only), back to the old and never changing sequence!

So this is a kind of permission problem! But... what kind of permission can be missing (and, as I said, the non-working user is at least admin of that machine, just not for the network...)... strange...

I guess I have to use my gym as the "dont ever use this account!" global admin???


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 46 guests