Live data from Hacker News

How random is xkcd? (2015)

hardmath123.github.io

81–90 of 133 posts

Re: How random is xkcd? (2015)

#81

I ran into this too. I run a very silly slack bot for my friends, and it randomly cycles through pictures that we all have created. Initially it was completely random choice per invocation. Had to change it to a randomly sorted list that was then stored and iterated through until the list is depleted, then it's re-randomised. For the same reason, complaints that actual random choice chose duplicate pictures too often

Note that if your playlist is append-only, you can use format-preserving encryption and just store a seed, a counter, and the length of the list when you started, instead of storing the whole shuffled list.

Re: How random is xkcd? (2015)

#82
post #31

I remember hearing Apple had to make a "random-seeming to humans" algorithm with the iPod's shuffle feature as well for the same reason. Grabbing a truly random song every play doesn't feel random to humans. What people really want with their song shuffle is something new they haven't played in a while.

I don't have many memories of experiencing this with my own iPod, but I recently came across this paper - "Does Your iPod Really Play Favorites?" (https://www.researchgate.net/profile/Jessica-Culhane/publica...).

In the paper, the authors examined evidence of nonrandom behavior and created several probability models for these events under the assumption of a random shuffle. Their conclusion was:

> Much of the evidence of nonrandom behavior reported by Steven Levy and others does not hold up when the probability models of the events are determined. Our results show the probability models for a random shuffle in many cases do not match the intuition of users. In addition, our statistical tests show the long-term occurrences of these events are within expectations under the assumption of a random shuffle.

I'm not sure if this was something Apple implemented after 2009.

Re: How random is xkcd? (2015)

#83

Earlier quoted context omitted.

There’s a really good article from Spotify Engineering that looks at exactly how Spotify bridged this gap between “random” and the “random” people actually expect. https://engineering.atspotify.com/2014/02/how-to-shuffle-son... It a good read on understanding what people generally expect when they ask for a random stream of songs (or comics), and how you can meet that expectation by carefully engineering how you gene…

Anecdotally, Spotify shuffle is one of the worst shuffles I've ever used. Or at least it used to be, not sure about now since they added Smart Shuffle. At least used to, maybe still, it would play a lot of songs over and over, but never play others. Like it had maybe 100 songs out of 2000 playing regularly, over and over. This isn't just me, but all my friends too. We're all the time finding old songs we saved that h…

I suspect it has something to do with how Spotify makes money and the likelihood they would intentionally bias their service towards playing songs that generate higher revenue per listen. If the complaints are not an example of the bias the article talks about, that is.

Re: How random is xkcd? (2015)

#84

Earlier quoted context omitted.

Anecdotally, Spotify shuffle is one of the worst shuffles I've ever used. Or at least it used to be, not sure about now since they added Smart Shuffle. At least used to, maybe still, it would play a lot of songs over and over, but never play others. Like it had maybe 100 songs out of 2000 playing regularly, over and over. This isn't just me, but all my friends too. We're all the time finding old songs we saved that h…

Their shuffle is completely broken, but so are all modern streaming music players. It used to be that shuffle would do just that - shuffle the deck of cards (playlist), and then deal the cards in order, never repeating until all cards have been dealt. Now it just keeps the playlist in the same order it was in and jumps all over the place, repeating songs and never playing some. It's very frustrating and woefully brok…

Well, as long as you don't go too far back: Old hardware media players with shuffle (mp3 players, even my cd player had a shuffle button) often used the same random seed, resulting in the same random order. My guess would be by accident due to restarts not preserving information.

Re: How random is xkcd? (2015)

#85
post #41

Earlier quoted context omitted.

I actually how people do purposefully non-random randomness more interesting. Like in this article. Video games are known to cheat a lot, usually in the player's favor. The Tetris randomizer for instance is well documented. Early games drew pieces truly randomly, but now, the standard is to draw randomly from a bag of all 7 pieces until it is empty, then repeat, limiting flood and draught. Along the way, other algori…

I was once tasked with creating a DVD game that was meant to randomly pick questions from its available pool. Learned lots of things about how unrandom random can be. On the lower end of DVD players, there was a stored list of values between 0 and maxInt that was randomized when created. Each call of the random function would just move the pointer to the next item in the list. This meant that it would essentially pla…

This reminds me of an mp3 CD player I had. I don't remember if the feature was called shuffle or random, but it played the same sequence of tracks every time. I could only fully enjoy it once per CD.

Re: How random is xkcd? (2015)

#86
post #67
post #63

Earlier quoted context omitted.

Is that wrong? I don't know the logic of the game, but a 20:10 battle can very well have different odds than a 2:1 one.

They're talking about ratios of unit-strength, which correlate directly to odds of success in a battle, not to numbers-of-units or anything more fuzzy like that. Given which, 20:10 and 2:1 have identical odds of success.

Do they, though? It depends on how the combat works.

Suppose, for example, that each side has 5 hit points, and repeatedly you roll a 2:1 die to decide who gets 1 point of damage, until one side reaches 0 hit points. The chance of an "upset", where the weaker side wins, is not 1/3; I compute it to be roughly 14%. If both sides start with 10 hit points, I compute the chance of an upset to be 6.5%. The law of large numbers means that, the more die rolls the combat involves, the less likely an upset is.

Or. Suppose that, at each step, one side has N soldiers and the other has M, and repeatedly a random soldier gets a kill; so that's an N/(M+N) chance that the first side gets a kill, and M/(M+N) that it's the other side. This would make advantages compound within the battle. Then I compute that a 2:1 initial matchup has a 5/6 chance (83%) of victory, and a 10:5 matchup has a 98.8% chance of victory.

(edit) I guess you could say I'm challenging the idea that "unit strength", such that when strength A fights strength B it's decided in one step with probability A/(A+B), makes sense as an abstract concept.

  (defmemo meh (a b p)
    (if (is b 0)
        1
        (is a 0)
        0
        (+ (* p (meh a dec.b p))
           (* (- 1 p) (meh dec.a b p)))))

  (defmemo nub (a b)
    (if (is b 0)
        1
        (is a 0)
        0
        (+ (* (/ a (+ a b))
              (nub a dec.b))
        (* (/ b (+ a b))
           (nub dec.a b)))))

Re: How random is xkcd? (2015)

#87
post #58

Earlier quoted context omitted.

Sid Meier talked about this wrt Civilization battle odds: https://youtu.be/bY7aRJE-oOY?t=1101

"Player psychology has absolutely nothing to do with rational thought ... the attacking unit has a strength of 1.5, and the defending unit has a strength of 0.5. So the attacking unit should win 3 times for every 1 time the defending unit wins. It's 3:1. That's just math. That's what the math says." Wow, I liked Sid Meyer a lot more before I listened to that arrogant diatribe about how stupid his players are and abou…

Hey friend. He's not saying they're stupid. He's saying they're irrational. And he's right. Humans aren't rational beings and our expectations differ from simple mathematical probabilities. When making Civilization 3 in the years leading up to 2001, his team had to make changes to the game so that it felt better to the players. They improved game design as you say that they should have, but made it an internal change so that the presented numbers "felt" right. They learned from this experience and he's presenting this learning in a lighthearted presentation to an audience containing some of the very players he's talking about. They got the humor in the situation fifteen years ago and thanks to that, you, me, and other people making and playing games today expect better presentation in our games.

Re: How random is xkcd? (2015)

#88

Earlier quoted context omitted.

There’s a really good article from Spotify Engineering that looks at exactly how Spotify bridged this gap between “random” and the “random” people actually expect. https://engineering.atspotify.com/2014/02/how-to-shuffle-son... It a good read on understanding what people generally expect when they ask for a random stream of songs (or comics), and how you can meet that expectation by carefully engineering how you gene…

Anecdotally, Spotify shuffle is one of the worst shuffles I've ever used. Or at least it used to be, not sure about now since they added Smart Shuffle. At least used to, maybe still, it would play a lot of songs over and over, but never play others. Like it had maybe 100 songs out of 2000 playing regularly, over and over. This isn't just me, but all my friends too. We're all the time finding old songs we saved that h…

> Perhaps it doesn't work as well with large playlists? Me and my friends tend toward 1000+ songs in a playlist, but most other playlists I've found are rarely over 250 songs.

I think you're right. Recently I spent a bit of time writing about and playing with various shuffling algorithms, trying to see if I could find something that works better for me than the built-in shuffle.

The answer is: it's hard! An algorithm that works for a well-distributed set won't work so well for something with large clusters of similar stuff (think a mixtape vs a playlist consisted of a dozen albums from six different artists). And even when you think you've come up with a good solution, it works well six times, and then the seventh you start to find something that doesn't work quite how you like. It's a process of tweaking.

My final test case was a large playlist like you describe, since I have a few of these, too.

This is what I found worked best for me:

- (Optionally) Fisher-Yates shuffle the whole thing, then - Slice the playlist into X chunks - Shuffle the order of the chunks using Fisher-Yates - Analyze the contents of the chunks - Pick a suitable shuffling algorithm based on the contents - Shuffle the contents of each chunk

There are lots of details around things like, how recently was this artist/album/compilation played? What's the relative tempo or genre of the most recent X songs, and how "harshly" are we willing to change it up? Is this a playlist with a lot of disparate songs (by artist/album/compilation) or is it a collection of like-minded albums and artists? Is the playlist just someone's discography? etc.

It takes a lot of passes and a lot of listening to find and tweak these things to find something that works and feels good. And in the end, I don't think the people who can do this are incentivized to actually do this. Especially considering the linked Spotify article is an entire decade old by now, and the Every Noise at Once guy was let go seemingly at random by Spotify. They care about "good enough for now" more than Actual Quality.

Re: How random is xkcd? (2015)

#89
post #49

Earlier quoted context omitted.

Sid Meier talked about this wrt Civilization battle odds: https://youtu.be/bY7aRJE-oOY?t=1101

Oh man this is an awesome talk, thanks for linking! Quick excerpt: > The player said “I lost a 2:1 battle, and I get that, I know I should lose that sometimes.” > I said, okay, so what’s the problem? > He said “well, I lost a 20:10 battle — what’s up with that?! 20 is so much more than 10!”

It seems reasonable to assume that's it's instead something like 10 simultaneous 2:1 battles, and you need to win a majority of them. That's very different odds than a single 2:1 battle.

He seems stuck on interpreting feedback through the lens of a linear-odds, one-shot model. The player feedback is that it shouldn't be linear, and there should be less randomness for larger numbers.

That all makes sense to me... and I suspect makes sense to him when he's not giving a talk for comedic effect.

Re: How random is xkcd? (2015)

#90

Kind of an aside to the nerd sniping happening here, but I think the fact that people complain about the random button is a sign that the feature isn’t doing what those people really want, even if it is doing what is advertised. Those people _want_ a button biased to return novel ones they haven’t read either in that session or across all time somehow, likely because they are using it to discover new comics.

First off, let me give a shout out to the author of the article. It's quite well written with clear support for the answer he provides.

Now back to the thread:

It turns out that most people expect "random" to mean a random selection without duplication (at least until the source is exhausted). That is called a non-replacement randomization: once a song (or comic, or whatever), is played/displayed, that item is no longer considered as part of the pool for future selection. However, that requires saving state for the individual user to save which information has been presented to this specific user, which adds a whole lot of additional requirements for cookies, or account registration, or other things that we all generally loathe.

The fundamental problem here is that most people don't really understand randomness and probability. If they did, casinos and lotteries would be out of business (see The Gambler's Fallacy[1]). This is not a failure of education, or mental capabilities: it is a fundamental friction with the way that the human brain has evolved.

The human brain is fundamentally a pattern matching system. We look for "meaning" by identifying patterns in our world and extrapolating what actions we should take based on those patterns. As such, we assume that _all_ systems have memory because that's how humans learn and take action, so we generally assume everything else does, too. But truly random events have no memory: there are streaks that appear "non-random" to us, such as multiple tails occurring in a streak during a fair-coin flip. But streaks often occur in truly random data, we as humans just don't expect it.

The existence of the Feynman Point[2] is an example that even someone well versed in randomness and math thought that a string of six 9's appearing in the value of PI, an irrational number, was something worth noting.

[1]: https://www.investopedia.com/terms/g/gamblersfallacy.asp [2]: https://en.wikipedia.org/wiki/Six_nines_in_pi

Post reply on HN