 level4 unnumbered">
<h4>Truncating above and below</h4>
<p>If there is a lower bound and upper bound, then the CDF trick is used
twice to find a lower and upper bound. For example, to generate a
<span class="math inline">\(\mathsf{normal}(\mu, \sigma)\)</span> truncated to a region <span class="math inline">\((a, b)\)</span>, the
following code suffices,</p>
<pre><code>real normal_lub_rng(real mu, real sigma, real lb, real ub) {
  real p_lb = normal_cdf(lb, mu, sigma);
  real p_ub = normal_cdf(ub, mu, sigm