Lurker News

Comments (230) 51 threads

andy_wrote4 replies#
There's a probability model called the Pólya urn where you imagine an urns containing numbered balls (colored balls in a typical example, but to draw the comparison with dice we can say they're numbered 1-6), and every time you draw a ball of a certain color, you put back more balls according to some rule. A few probability distributions can be expressed in terms of a Pólya urn, see https://en.wikipedia.org/wiki/P%C3%B3lya_urn_model.

A fair 6-sided die would be an equal number of balls numbered 1-6 and a rule that you simply return the ball you drew. You can get a gambler's fallacy distribution by, say, adding one of every ball that you didn't draw. I read the code as a Pólya urn starting with 1 ball 1-N and doing that on each draw plus reducing the number of balls of the drawn number to 1.
Also related, in 2d space, is the idea of randomly covering the plane in points but getting a spread-out distribution, since uniformity will result in clusters. (If you're moving a small window in any direction and you haven't seen a point in a while, you're "due" to see another one, and vice versa if you just saw a point.) Mike Bostock did a very nice visualization of that here: https://bost.ocks.org/mike/algorithms/

xori3 replies#
Thank you! Sometimes the hardest thing is knowing what to google!
duxup1 reply#
I do a lot of furious googling thinking: "Oh man this has to be a thing but what could it be and how would someone describe it?... awe forget it."

Then months later by accident while looking at a completely different topic: "OMG there it is, the thing!"

CPLX#
Indeed. This happened to me the other day trying to find the name for a domino joiner while googling for biscuit joiners.
Grae#
Today I learned the true name of true name.
dminor1 reply#
Another algorithm along these lines is the "shuffle bag" algorithm.
femto113#
Settlers of Catan switched to this at some point--from 2 dice to a set of numbered tiles with the same distribution that you shuffle and draw from. It definitely pared some "oh man I'm so unlucky" scenarios from the game but I'm not convinced it made it more fun.
petschge1 reply#
Covering the plane randomly but without clusters is actually quite useful in simulations. The "random" numbers that do that are often call "low-discrepancy sequence".
thaumasiotes1 reply#
Also called "quasirandom" numbers, as I learned it from wikipedia years ago. ("Quasirandom" and "quasirandom numbers" today redirect to "low-discrepancy sequence".)
petschge#
There is many names for it. The problem with "quasirandom" is that is sounds a lot like "pseudorandom". For the special case of points in a plane looking for "Poisson disk sampling" also brings many great resources.
andy_wrote#
Interesting - just perusing those links, it sounds like a multi-armed bandit problem, in which you reason that if something has worked out before, you should tilt your bets more in that direction. In the context of the urn model, you'd return more balls of the same color for every successful draw. In the context of medicine, you can balance between proving or disproving a treatment effect and actually supplying that treatment to the test subjects who need them.

Relatedly, there's a Bayesian interpretation to overweighting successful past draws. A model where you return one extra ball of the same color to the urn gets you a Dirichlet-multinomial distribution, which is a die-roll distribution where the weights to each face are not known for sure, but are given a probability distribution and revised with observed evidence. In other words: here's an n-sided die, I don't know its weightings, but as I observe outcomes I'll update my beliefs that the sides that come up are more favorably weighted. The number of balls in the urn you start with correspond to your priors; only 1 ball of each color means a very weak belief that it's a fair die, 1000 balls of each color means a strong belief, unequal numbers mean that you start off believing it's weighted.

ideonexus18 replies#
A great application for this is in randomizing playlists. My friends, who are also CS grads and should know better, have often complained that their MP3 players, CD carousels, etc play the same music too often claiming that the random is broken, when a song repeating in a short period of time or other songs never playing is what you would expect from a truly random selection. Using this algorithm, you'd be sure to hear all of your songs. I'm guessing most music services already do something like this.
nxc181 reply#
I think the original Zune had a bad randomizer. In my experience it would tend to play two songs from the same artist back to back.

Whether this was because they had a botched 'smart' randomizer or because they in fact used true random to shuffle, I may never know.

abritinthebay#
The iPod and iTunes used to do this too - it’s because of a behavior you’d actually expect in a true randomizer called clustering.

Supposedly Jobs specifically “fixed” this behavior and it’s why there used to be (still is?) a slider that allowed you to customize that behavior.

drewrv6 replies#
This is also an example of users saying they want one thing (randomness) when really they want something else (variety).
Sholmesy#
Both this and the GP are great lessons in software design.
nkrisc2 replies#
Great example of finding what users really want as opposed to what they say they want.
stubish#
Or a great example of how things fail when producers and consumers don't use the same language. If you don't understand the language your consumers are speaking, you are not going to produce what they want.

So next time some one tells you their computer is broken, don't reply saying it appears to be in one piece.

Tarq0n#
This sounds like a giant strawman to me. Where do programmers get the idea that a mode called 'shuffle' would call for sampling with replacement? The obvious software analogy to shuffling would be re-ordering a list randomly, not randomly drawing from a list.

I think this whole shuffling meme started with Spotify's engineers misunderstanding what they were asked to do, then claiming their customers don't know what they want when they obviously delivered the wrong feature.

cestith1 reply#
Shuffle and weighted random both give a better chance of variety than truly random. Shuffle is cheaper to calculate in terms of storage space.

The article is about weighting randomness based on past distribution. In a music playlist that may be enough. Some user might also want a term in the equation that weights songs they've rated highly to be favored over lower-rated or unrated songs.

gpawl#
"truly random" refers to how well a real distribution matches its intended distribution. So, a long cycle is not truly random, because many desired outcomes are physically possible to obtain.

This is orthognal to the choice of distributon. Shuffle and Weighted Sampling are different choices of distribution.

xg15#
This - and possibly also a reminder that the same words may mean different things for people with different backgrounds.

If someone with no specialized knowledge about math and probability requests their songs in a "random" order, I don't think one should assume they are insisting on an order sampled from a uniform distribution.

mulmen#
"If I had asked people what they wanted, they would have said faster horses." - Henry Ford
Jasper_#
Because the casual definition of "random" means "without a discernible pattern", which multiple artists in a row doesn't handle. Music shuffle algorithms sometimes go lengths to avoid patterns and duplicate artists.
michaelmcmillan5 replies#
I actually tested the random distribution of Spotify's shuffle functionality: http://michaelmcmillan.net
Jackim#
I appreciate the simplicity of your site but it is definitely difficult to quickly see where one post ends and another one starts.
RugnirViking2 replies#
On your website you put a source mark on the statement 'This is the same reason the Brits mistakenly assumed that the Germans had an exceptionally good aim with their V-1 flying bombs during World War II '

I'd like to read about this, do you still have the intended link?

feider#
Thinking fast & slow by D.Kahneman mentioned this same story
wodenokoto2 replies#
I have a theory that Spotify doesn't do random shuffling, but weighted shuffling, so that new items are more likely to be at the top of a shuffle (or maybe even popular items). I also believe that this will satisfy users better than true random shuffling.

About your linked post: You don't test the randomness of the shuffling, you only test if a shuffled list contain one and only of each original item.

c3534l#
Spotify officially says it's not random.
surement#
>I have a theory that Spotify doesn't do random shuffling, but weighted shuffling, so that new items are more likely to be at the top of a shuffle

Amazon Music does this and it annoys me. Just because I added something a while ago doesn't mean I want to hear it less.

lwansbrough1 reply#
Spotify's shuffling is most certainly not random. Every once in a while I get a bug where it simply shuffles through various songs from 4-5 albums and will never pick songs outside that set. Restarting the app corrects the behaviour. To me that's some level of proof, because the songs are all there. So what's the algorithm really doing?
fhood#
I get this as well, and I think it gets worse the larger the playlist. It really makes me miss itunes' shuffling algorithms.

Continue this thread — 3 replies

Continue this thread — 15 more replies

Pfhreak20 replies#
Interesting, and at first I was excited about the possibilities in something like D&D, where a series of bad rolls can have you feeling down. "I'm due for a critical hit any swing now..."

Players would love that! Make my hero feel more heroic! The inevitable comeback!
But then I thought about the inverse case -- you are doing really well, and now you are due for a failure. Or series of failures. That would feel awful.
We have a lot of emotions around dice rolling. I wonder if players really want from their dice. Would players prefer dice that are secretly unevenly weighted towards good rolls? Would they still want those dice if they knew they were weighted?

Continue this thread — 20 replies

doodpants2 replies#
> I made a chatbot that rolled dice, and it was constantly criticized for being "broken" because four 3's would come up in a row.

> These accusations would come up even though they (all being computer science majors) know it's possible (although unlikely) for these events to happen. They just don't trust the black box.
I am reminded of the approach that GamesByEmail.com used to address this criticism: http://www.gamesbyemail.com/News/DiceOMatic

Continue this thread — 2 replies

Load more comments