Skip to content
CoreSource checked

Latin Hypercube Sampling

Samples each dimension so every interval stratum is used exactly once.

Quick Facts

Compact metadata for implementation and discovery.

Category
Randomness & Sampling
Difficulty
Intermediate
Family
Stratified Sampling
Tier
Core
Status
Verified
Review
Source Checked
Sources
2
Formulas
1
Relationships
3
Code example
Ready
Visualization
Ready

Overview

Latin hypercube sampling improves coverage over independent random sampling by stratifying each dimension independently.

Core Concepts

dimension stratificationpermutationsample coveragevariance reduction

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(n d)

Average

O(n d)

Worst

O(n d)

Space

O(n d)

When to Use

  • Use when monte Carlo simulation needs dimension stratification.
  • Use when the input matches the assumptions behind stratified Sampling.

When Not to Use

  • Avoid when independence, reproducibility, or distribution quality cannot be checked.
  • Avoid when a simpler algorithm gives the required result with less setup.

What It Does

  • Samples each dimension so every interval stratum is used exactly once
  • Uses dimension stratification and permutation to guide the work.
  • Produces samples.

Use Cases

  • Monte Carlo simulation
  • Randomized algorithms
  • Sampling distributions

Inputs

  • Random source
  • Distribution or weights
  • Sample count

Outputs

  • Samples
  • Estimated statistic
  • Randomized selection

Key Formulas (1)

Stratum sample

x = (perm[i] + u) / N
x = (perm[i] + u) / N

Places one random point inside each dimension's assigned stratum.

Pseudocode

  1. 1.Initialize the random source, sequence state, or sampler parameters
  2. 2.Generate the next candidate, variate, or structured random choice
  3. 3.Accept, transform, weight, or record the value according to the method
  4. 4.Repeat until the requested sample count or stopping rule is reached

Canonical Example

Input
seed = 7, sample count = 5, and a small target distribution or domain
Output
Samples
Explanation
Latin Hypercube Sampling applies dimension stratification to produce samples.

Implementation Notes

  • Expose seed handling when reproducibility is important.
  • Keep the dimension stratification step separate enough to test independently.
  • Separate the random source from the sampler so tests can use fixed seeds and distribution checks.

Common Pitfalls

  • Using a biased random source can quietly invalidate downstream estimates.
  • Test edge cases, not only clean examples.
  • Uncontrolled seeds or biased random choices can make results irreproducible or statistically misleading.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Plot generated samples against the target distribution or domain.

Latin Hypercube Sampling mechanism walkthrough step 1 of 4x₀x₁x₂x*
Step 1 of 4: Initialize the random source, sequence state, or sampler parameters
randomness-sampling-mechanism

Notes

Latin Hypercube Sampling should be used with the assumptions and tradeoffs of stratified Sampling in mind.

Sources (2)

What each reference supports for this entry.

Latin Hypercube Sampling

Paper

Original reference for Latin hypercube sampling in computer experiments.

Open source

Monte Carlo Statistical Methods

Book

Monte Carlo reference for Latin Hypercube Sampling's estimator construction, sampling assumptions, and variance behavior.

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Alternative toSobol Sequence

Both improve multidimensional coverage with different deterministic or randomized designs.

Latin Hypercube Sampling stratifies each dimension of the sample space.

Tags

Randomness & SamplingStratified SamplingSamplingStochastic