File Exchange

image thumbnail

Truncated Normal Generator

version (3.47 KB) by Zdravko Botev
truncated normal generator


Updated 21 Apr 2016

View License

Very fast generator of vectors from the standard multivariate normal or Gaussian distribution, truncated over the region [l,u]. The generator is designed for both speed and accuracy --- especially in the tail of the normal distribution, where the inverse transform method frequently breaks down due to underflow errors.
Reference: Botev, Z. I. (2016). "The normal law under linear restrictions: simulation and estimation via minimax tilting". Journal of the Royal Statistical Society: Series B (Statistical Methodology). doi:10.1111/rssb.12162

For more information, see:

Comments and Ratings (10)

Thank you for writing this simulator. Really helps!

Seongjin Jin

Stone Mathers

Andrew Benson

Thank you! This was way more efficient than my own code!

qiang zhang


- added some space to reference and a few more keywords

- updated reference; algorithm remains unchanged

Added a title and picture to the submission.

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor