sampleTruncatedNormalPdf function

List<num> sampleTruncatedNormalPdf(
  1. int n,
  2. num min,
  3. num max,
  4. num mean,
  5. num stdDev,
  6. {int seed}
)

Returns a random sample of size n following a truncated normal distribution with:

  • min: minimum value,
  • max: maximum value,
  • mean,
  • stdDev: standard deviation.

  • seed: random generator seed (optional).

Implementation

List<num> sampleTruncatedNormalPdf(
  int n,
  num min,
  num max,
  num mean,
  num stdDev, {
  int? seed,
}) =>
    samplePdf(
      n,
      min,
      max,
      truncatedNormalPdf(mean, min, max, mean, stdDev),
      (x) => truncatedNormalPdf(x, min, max, mean, stdDev),
    );