PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Statistics & Math/Sybill

Design tests to verify shuffle randomness

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's skills in statistical experiment design, hypothesis testing, and randomness analysis for algorithmic shuffles, focusing on detecting nonuniformity and inter-run dependence.

  • hard
  • Sybill
  • Statistics & Math
  • Software Engineer

Design tests to verify shuffle randomness

Company: Sybill

Role: Software Engineer

Category: Statistics & Math

Difficulty: hard

Interview Round: Technical Screen

How would you test whether your array shuffling function is truly random? Outline an experiment: define null and alternative hypotheses, select statistical tests (e.g., chi-square goodness-of-fit on position frequencies and tests for pairwise independence), determine sample size and significance level, and describe how you'd detect bias or correlations. Explain how you would implement and automate these tests in JavaScript.

Quick Answer: This question evaluates a candidate's skills in statistical experiment design, hypothesis testing, and randomness analysis for algorithmic shuffles, focusing on detecting nonuniformity and inter-run dependence.

Sybill logo
Sybill
Aug 10, 2025, 12:00 AM
Software Engineer
Technical Screen
Statistics & Math
1
0

Experiment Design: Is Your Array Shuffle Truly Random?

You're given a shuffle(arr) function that takes an array of n distinct items and returns a random permutation. Design a rigorous test plan to assess whether the shuffle is uniform and independent across runs.

Requirements:

  1. State hypotheses
    • Null and alternative hypotheses for uniformity over permutations and independence across runs.
  2. Specify tests
    • Position uniformity (e.g., chi-square goodness-of-fit/independence on item-by-position counts).
    • Pairwise order/adjacency tests to probe correlations between items.
    • Any additional tests to catch common implementation bugs.
  3. Choose sample size and significance level
    • Derive or justify trial counts T, alpha, power, and multiple-testing correction.
  4. Bias/correlation detection
    • How to localize and diagnose nonuniformity or dependence.
  5. Implementation and automation in JavaScript
    • Outline data collection, statistics, p-values, pass/fail logic, and CI strategy.

Assume: We can call shuffle repeatedly as a black box. We can choose n (e.g., 10–52) and run T trials.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Statistics & Math•More Sybill•More Software Engineer•Sybill Software Engineer•Sybill Statistics & Math•Software Engineer Statistics & Math
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.