Google · ML Coding
Define and sample a truncated normal
TrueInterview
October 7, 2026 · 1 min read
Define the truncated normal variable for : write down its normalized pdf and cdf. Next, construct efficient samplers for three cases: (i) ; (ii) ; (iii) . For each case, contrast inverse-CDF sampling — draw and set — with simple rejection sampling from by computing the expected acceptance rate: , , and . Suggest an algorithm that works well in extreme tails (for example, exponential or half-normal proposals within acceptance–rejection), discuss the numerical stability of evaluating and near machine precision, and describe how you would validate the sampler (a KS test on back-transformed uniforms, plus moment checks).
Overview: This question tests skill with probability distributions and Monte Carlo sampling methods in the Statistics & Math area, centered on the truncated normal distribution, its normalized pdf/cdf, and the design and comparison of samplers for moderate and extreme tail regimes.