Truncated Gaussian Law

Parameters

$$µ \in \mathbb{R} $$

$$\sigma^2>0$$

$$ -\infty < min < max < +\infty$$

Support $$x \in [\mathbb{R}] \quad and \quad p \in \:]0,1 [$$
PDF $$
PDF = \frac {
\frac{1}{ \sqrt{2 \times \sigma^2 \pi }} e^{ \frac { (x-µ)^2 } { 2 \sigma^2 } }
}
{
\sigma \times \left\{ \frac {1}{2} \left[ 1 + erf \left(\frac {max – µ} { \sigma \sqrt{2}} \right) \right]
– \frac {1}{2} \left[ 1 + erf \left(\frac {min – µ} { \sigma \sqrt{2}} \right) \right]
\right\}
}
$$
CDF $$
CDF = \frac {
\frac {1}{2} \left[ 1 + erf \left(\frac {x – µ} { \sigma \sqrt{2}} \right) \right]
– \frac {1}{2} \left[ 1 + erf \left(\frac {min – µ} { \sigma \sqrt{2}} \right) \right]
}
{
\frac {1}{2} \left[ 1 + erf \left(\frac {max – µ} { \sigma \sqrt{2}} \right) \right]
– \frac {1}{2} \left[ 1 + erf \left(\frac {min – µ} { \sigma \sqrt{2}} \right) \right]
}
$$
CDF-1 $$
CDF^{-1} = \sigma \times \sqrt{2} er f^{-1}
\left(
2 \times
\left\{
\frac{1}{2}
\left[
1 + er f
\left (
\frac {min-µ}{ \sigma \sqrt {2}}
\right )
\right ]
+ p \times
\left\{
\frac {1}{2}
\left[
1 + er f
\left(
\frac{max-µ}{\sigma \sqrt{2}}
\right)
\right]
– \frac {1}{2}
\left[
1+er f
\left (
\frac {min-µ}{\sigma \sqrt {2}}
\right )
\right]
\right \}
\right \}
\right) + µ \quad
$$