#ifndef __NormalDistribution_h_ #define __NormalDistribution_h_ /* Use this class to approximate the normal distribution curve. The underlying * implementation is a binomial distribution with interpolation. Use more * points to get a more precise answer. 1000 points can give an answer * accurate to within 0.01% of the correct answer. * * This class stores a table of values. Creating the class takes longer than * an individual lookup. You should only create the table once if you can * help it. */ class NormalDistribution { private: double *_points; double _mean; double _stdDev; int _max; public: NormalDistribution(int numberOfPoints = 1000); ~NormalDistribution(); double probability(double from, double to) const; // Inputs are Z-scores. double probability(double to) const; // From negative infinity. }; #endif