Shuffle Issue on Xbox One (and other players)

xbox-360

#1

Hello,

I'm having an issue with the shuffle feature on xbox one (this is happening elsewhere as well. reddit thread link posted below).

When I hit shuffle on a TV show that has 100+ episodes, it usually only plays the same 10-15 episodes each time. It doesn't seem to be truly random. Last night I hit shuffle 3 times and it tried to play the same episode each time.

Is there any fix for this planned?

Reddit post here: https://www.reddit.com/r/PleX/comments/3rcuqf/shuffle_seems_to_be_not_so_random_xbox_one/


#2

The "Shuffle isn't random" bug is very annoying. We play kids TV shows for our children by putting an entire show on shuffle. There's definitely about 6 episodes that always make it into the first couple episodes played. If I enable debug logging even in verbose mode, the random sequence generated isn't captured. Regardless, the reason for the repeated patterns is usually caused by using poor random number generators. I'd bet $100 that's the case here.

Plex devs, please go back to your code and use a cryptographically derived random number or bytes to use as a seed value. If you use something simplistic like RAND or a cruddy seed value that some programmer though would be clever, that's exactly how you end up with these repeating patterns. This is a very well known phenomenon in software, especially those experienced with secure coding practices. In .NET, use RNGCryptoServiceProvider. For everything else, go straight to the BCryptGenRandom function in Bcrypt.dll. That's the underlying function used by RNGCryptoServiceProvider in .NET. In OS X, you can get cryptographically secure pseudorandom numbers by reading bytes from the /dev/random device file.