News for hackers. Stuff that matters.
Re:How to Shuffle Songs? (2014) by theshrike79 on Tuesday November 21, 2023 @01:30AM (#38360123)
This is one of my favourite things about psychology, perception and programming.

When people say they want to "randomly shuffle a playlist", they really don't want that. They want the perception of randomness, but _true_ random doesn't abide by rules.

If you're actually random, there is a probability that it might just play all the songs straight through. Or just pick songs by a single artist back-to-back.

Re:How to Shuffle Songs? (2014) by xjay on Tuesday November 21, 2023 @03:41AM (#38361031)
Rob Pardo (Blizzard, World of Warcraft (2004)) said they decided to model randomness after how players thought it worked.

> ..at least once a week, a developer would come to my office, and say "the random number generator is broken, we need to look at it."--It's because they hit a streak. [1]

[1] https://www.youtube.com/watch?v=FhC0NaB6ock&t=2343s

He shares more details about game design choices in the video.

Re:How to Shuffle Songs? (2014) by PetitPrince on Tuesday November 21, 2023 @07:32AM (#38362763)
Video games are rife with randomness manipulation.

- X-Com 2 lies in favor of the playing when displaying a chance of hitting of 85% [ https://www.gamedeveloper.com/design/jake-solomon-explains-t... ]

- Baldur's Gate 3 "Karmic Dice" will prevent streaks of very high or lows rolls

- Tetris games doesn't use Math.random for piece distribution. Most modern Tetris (like Tetris Effect) uses Fischer-Yates with 7 pieces (in the community we call 7-bag) or 14 pieces (it avoids repetition "at the seam" of a bag). The Tetris game I like the most (Tetris the Grand Master) uses a history system (the chance of receiving a recently distributed piece is heavily reduced; it's less predictable than 7-bag). IIRC even classic NES Tetris has a repetition avoidance system.

Re:How to Shuffle Songs? (2014) by qsort on Tuesday November 21, 2023 @08:05AM (#38363125)
I don't know if that's still the case (haven't played in more than three years), but Magic the Gathering Arena (digital version of the collectible card game) used to rig the opening hands to make them "more average".

This had consequences on competitive play; they wouldn't even tell you how exactly the algorithm worked, so the only way to build a deck was lots and lots of simulations.

Re:How to Shuffle Songs? (2014) by traverseda on Tuesday November 21, 2023 @10:55AM (#38365360)
There are also specific physical shuffling techniques used in physical magic the gathering games, in order to distribute mana more "evenly".
Re:How to Shuffle Songs? (2014) by qsort on Tuesday November 21, 2023 @11:03AM (#38365472)
Yeah, but those are cheating, and it's not particularly easy to cheat in that specific way. In a high level match, whenever you shuffle your deck, your opponent can (and in fact is required to) also shuffle it, and they're the last to touch it.

Cheaters, like in any game, tend to look for methods that maximize the combination of impact and plausible deniability. Marked sleeves, sleight of hand (pun very much intended) etc.

Re:How to Shuffle Songs? (2014) by traverseda on Tuesday November 21, 2023 @04:05PM (#38370115)
It can also be used in friendly games, where everyone is aware of it.
Re:How to Shuffle Songs? (2014) by gosub100 on Tuesday November 21, 2023 @10:03AM (#38364530)
there was a whole HN post about the Tetris RNG a few months back. I'm too lazy to search rn but it might be worth a read for others.
Re:How to Shuffle Songs? (2014) by mitsu_at on Tuesday November 21, 2023 @05:12PM (#38371108)
previously:

https://news.ycombinator.com/item?id=20872110 - Sep 2019 (41 comments)

https://news.ycombinator.com/item?id=37107346 - Aug 2023 (16 comments)

Re:How to Shuffle Songs? (2014) by livrem on Tuesday November 21, 2023 @10:22AM (#38364803)
Jonathan Blow did a good talk on this, but unfortunately the only version of it I know of is concatenated by some youtube uploader with a silly twitch stream (also by Jonathan Blow, but less interesting, and not even sure he is correct about that particular game being rigged?) so just stop watching after the presentation: https://www.youtube.com/watch?v=l0KEDYFWbVc ("Explicit Lying" seems to be the title of the talk?)
Re:How to Shuffle Songs? (2014) by Nullabillity on Tuesday November 21, 2023 @07:42AM (#38362878)
A shuffled deck of cards is still random, even if the probabilities of each card draw aren't independent.
Re:How to Shuffle Songs? (2014) by executesorder66 on Tuesday November 21, 2023 @10:34AM (#38365001)
An easier solution is to not say e.g. "this attack has a 25% hit probability" but rather say "this attack will hit every 4th time".

Then you are not lying to the users, and your tooltips/docs etc. are correct as well.

Re:How to Shuffle Songs? (2014) by Akronymus on Tuesday November 21, 2023 @01:53AM (#38360267)
I want all songs truly randomized once, then playing in that order.

Sadly youtube just picks the next one based on the current ones ID + some seed, so it constantly gets stuck in loops

Re:How to Shuffle Songs? (2014) by bayindirh on Tuesday November 21, 2023 @04:08AM (#38361219)
Sony's CD players used to choose the next when the song finished, however it removed the ones from the candidate list, so it never looped.

As another neat trick, they have added a small animation while seeking to next track with some lower time bound, so it looked like thinking for a second or so. In reality, the decision was instant, seeking was not.

Re:How to Shuffle Songs? (2014) by Retr0id on Tuesday November 21, 2023 @03:07AM (#38360783)
I'm amazed youtube hasn't figured out a way to detect and avoid these loops, it seems like a solvable problem. Even a naive solution like having the client remember the last n played tracks, and not auto-play any of them (picking the next one down) would be a big improvement.
Re:How to Shuffle Songs? (2014) by Bewelge on Tuesday November 21, 2023 @05:08AM (#38361690)
I have had the (conspiracy) theory for a while that this is by design. Kept happening to me on an account where I've disabled watch-history. Now I'm watching on an account where it's enabled and it hasn't happened even once. And it's been months since I switched.

Actually not sure if it's even that far fetched. Making the logged-out-experience worse on purpose is something all the big internet firms do.

Re:How to Shuffle Songs? (2014) by kubanczyk on Tuesday November 21, 2023 @06:20AM (#38362182)
But... You've asked YT not to remember the previous videos, and it doesn't: LGTM.

There could be advanced implementations (like with the remembered passwords, where YT would store a list of seeded hashes of your viewed videos). But they are that: advanced implementations, that impose an extra cost.

Re:How to Shuffle Songs? (2014) by Bewelge on Tuesday November 21, 2023 @07:51AM (#38362976)
Yea I guess you're right that in this case it probably boils down to extra cost.

Though I still think "not remembering watch history" (and adjusting what you are shown based on that) to mean that a functionality that doesn't have anything to do with tracking (because it only requires information from your current session) to be a little lazy.

You wouldn't expect a slide-show of images to be shown in random order, just because you didn't consent to the cookie banner.

But in all fairness - I really like youtube's auto-play and suggestion algorithm when it comes to music. I use it for free and I haven't seen an ad in years so I don't want to complain :)

Re:How to Shuffle Songs? (2014) by Akronymus on Tuesday November 21, 2023 @06:37AM (#38362302)
I have watch history enabled and still get the loops all the time.

I even went so far to seek out a website that does it for me, and which I set up as a bookmark https://youtube-playlist-randomizer.bitbucket.io/

Altough, seems like the site is now broken

Re:How to Shuffle Songs? (2014) by Bewelge on Tuesday November 21, 2023 @07:55AM (#38363032)
That's interesting.

I used to get it all the time and haven't experienced it since switching to an account where it's enabled. I guess it may have just been a coincidence.

Re:How to Shuffle Songs? (2014) by taneliv on Tuesday November 21, 2023 @03:10AM (#38360808)
Back in the 90s, when portable CD players were still a thing, I had one.

It had a toggle for random play. It indeed apparently played the tracks at random.

By random I mean random, not shuffle. It would play the same track multiple times during a listening session. For example tracks in order like 2, 2, 7, 8, 7, ...

I actually liked that.

If memory serves, it would stop playing after it had played each track at least once. If there were a lot of tracks it would not finish, at least not before the batteries ran out.

Re:How to Shuffle Songs? (2014) by tjoff on Tuesday November 21, 2023 @06:51AM (#38362417)
Hah, that reminds me of Spotify. If you had shuffle on and it happened to play the last song it would stop playing, because it was the last song in the playlist ...
Re:How to Shuffle Songs? (2014) by troupo on Tuesday November 21, 2023 @02:51AM (#38360657)
> When people say they want to "randomly shuffle a playlist", they really don't want that.

Same in games. "I had an 80% chance to hit and didn't" is a perfect example.

Re:How to Shuffle Songs? (2014) by zorr on Tuesday November 21, 2023 @03:06AM (#38360774)
Leading to features like "Karmic Dice" in the recent Baldur's Gate 3
Re:How to Shuffle Songs? (2014) by thaumasiotes on Tuesday November 21, 2023 @10:00AM (#38364482)
There is a consideration there that isn't necessarily a problem with randomness itself. (Though I agree that the randomness does bring its own problems.)

Say you're playing through someone's electronic D&D module and you try to do something with a 90% chance of success. Then you roll a 2. You didn't make a mistake when deciding what to do, so that feels wrong -- this is a problem with randomness.

What do you do? You reload from right before you tried to do the thing, and you reroll. The game can't actually make you accept randomness if you don't want to. So they have to do something else.

Re:How to Shuffle Songs? (2014) by mhitza on Tuesday November 21, 2023 @05:04AM (#38361665)
It also depends how well that randomness makes sense in games. In my recent memory nothing was more ludicrous that the modern XCOM games where you were upclose to an enemy and got only 90% hit chance with a shotgun.
Re:How to Shuffle Songs? (2014) by t-3 on Tuesday November 21, 2023 @05:19AM (#38361757)
To be fair, this is due to game devs giving percentage chances that are straight-up lies. "80% and didn't hit" is actually "92% and didn't hit" in many Fire emblem games, for example (https://fireemblemwiki.org/wiki/True_hit).
Re:How to Shuffle Songs? (2014) by oneeyedpigeon on Tuesday November 21, 2023 @05:21AM (#38361766)
The problem isn't that people "don't want random", the problem is that "random" isn't unambiguous. Shuffling a playlist before playing it is just as 'random' as picking any one of the tracks to play next.
Re:How to Shuffle Songs? (2014) by caturopath on Tuesday November 21, 2023 @10:08AM (#38364613)
> there is a probability

There is a probability that entropy will decrease, it's just small enough to neglect. Playing songs straight through isn't really a concern.