Runs Test for Streaks in YouTube Music Shuffle Play

Last updated: November 29, 2026

Quick Overview

Users complain that YouTube Music shuffle plays long streaks from one artist. In a 40-track session alternating between two artists' songs, you observe only 8 runs (maximal streaks). Test whether this sequence is consistent with a random shuffle.

Google
Statistics & Math
Data Scientist
Google
November 29, 2026
Data Scientist
Technical Screen
Statistics & Math
Medium

0

0

0 solved


Users complain that YouTube Music shuffle plays long streaks from one artist. In a 40-track session alternating between two artists' songs, you observe only 8 runs (maximal streaks). Test whether this sequence is consistent with a random shuffle.

Shuffle fairness is a product question with a statistics core, and Google interviewers like seeing a candidate pick a test that matches the complaint. The runs test directly targets streakiness rather than overall balance.

What the Interviewer Expects
  • Define runs and why they measure streakiness
  • Give the mean and variance of runs under randomness
  • Compute the z statistic
  • Explain that people perceive randomness as too streaky
  • Suggest how to evaluate shuffle across many sessions
Key Topics to Cover
runs test
Wald-Wolfowitz
randomness testing
permutation null
perception of randomness
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
  • How would you test a whole day of sessions rather than one?
  • Many users want an 'anti-streak' shuffle; how would you design and evaluate it?
  • How would you handle more than two artists?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Browse Statistics Questions
Sample Answer
Clarify

Assume the 40 tracks consist of 20 from artist A and 20 from artist B, and a fair shuffle makes every ordering equally likely. A run is a maximal block of consecutive tracks from one artist. Too few r...

Approach

For n1n_1 and n2n_2 items, under a random ordering the number of runs RR has E[R]=1+2n1n2n,Var⁡(R)=2n1n2(2n1n2−n)n2(n−1)E[R] = 1 + \frac{2 n_1 n_2}{n}, \quad \operatorname{Var}(R) = \frac{2 n_1 n_2 (2 n_1 n_2 - n)}{n^2 (n - 1)} and is app...


Submit Your Answer
Markdown supported