Pseudorandom and Quasirandom Number Generation

Generate pseudorandom and quasirandom sample data

In certain circumstances, the common methods of random number generation are inadequate to produce the desired samples. Statistics and Machine Learning Toolbox™ offers several alternative methods to generate pseudorandom and quasirandom numbers. Quasirandom numbers, also known as low discrepancy sequences, generate each successive number as far away as possible from existing numbers in the set. This approach avoids clustering and can speed up convergence, but quasirandom numbers are generally too uniform to pass randomness tests. Pseudorandom numbers are less uniform than quasirandom numbers and may be more appropriate for applications that require greater randomness. Use the slice sampler, the Hamiltonian Monte Carlo sampler, or the Metropolis-Hastings Markov chain sampler to generate pseudorandom samples by drawing from a statistical distribution.

If the available parametric probability distributions do not adequately describe your data, you can use a flexible distribution family instead. The Pearson and Johnson flexible distribution families fit a model based on the location, scale, skewness, and kurtosis of the sample data. Once you fit a distribution to your data, you can generate pseudorandom numbers from that distribution.

Functions

expand all

slicesampleSlice sampler
mhsampleMetropolis-Hastings sample
hmcSamplerHamiltonian Monte Carlo (HMC) sampler
pearsrndPearson system random numbers
johnsrndJohnson system random numbers

Classes

expand all

haltonsetHalton quasirandom point set
qrandstreamConstruct quasi-random number stream
sobolsetSobol quasirandom point set
HamiltonianSamplerHamiltonian Monte Carlo (HMC) sampler

Topics

Representing Sampling Distributions Using Markov Chain Samplers

Markov chain samplers can generate numbers from a sampling distribution that is difficult to represent directly.

Bayesian Linear Regression Using Hamiltonian Monte Carlo

Learn how to use the Hamiltonian Monte Carlo sampler.

Generating Data Using Flexible Families of Distributions

The Pearson and Johnson systems are flexible parametric families of distributions that provide good matches for a wide range of data shapes.

Random Number Generation

Statistics and Machine Learning Toolbox supports the generation of random numbers from various distributions.

Generating Pseudorandom Numbers

Pseudorandom numbers are generated by deterministic algorithms.

Generating Quasi-Random Numbers

Quasi-random number generators (QRNGs) produce highly uniform samples of the unit hypercube.