From 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Thu, 2 Jul 2026 11:55:17 -0700 Subject: Init --- Homework/cs3460/rands/distributions.hpp | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Homework/cs3460/rands/distributions.hpp (limited to 'Homework/cs3460/rands/distributions.hpp') diff --git a/Homework/cs3460/rands/distributions.hpp b/Homework/cs3460/rands/distributions.hpp new file mode 100644 index 0000000..18e982d --- /dev/null +++ b/Homework/cs3460/rands/distributions.hpp @@ -0,0 +1,65 @@ +#include +#include +#include +#include +#include +#include +#include + +#ifndef DISTRIBUTIONS_HPP + +class DistributionPair +{ + public: + DistributionPair(std::uint32_t minValue, std::uint32_t maxValue) : + minValue(minValue), maxValue(maxValue), count(0) + { + } + + std::uint32_t minValue; + std::uint32_t maxValue; + std::uint32_t count; +}; +/* + @param title: std::string, the title to display of the plot + @param distribution: const std::vector&, reference to bins + @param maxPlotLineSize: const std::uint8_t, max length of a line of the plot + @return void: plot to stdout +*/ +void plotDistribution(std::string title, + const std::vector& distribution, + const std::uint8_t maxPlotLineSize); +/* + @param howMany: uint32_t, the length of the random sequence + @param min: uint32_t, the minimum element possible + @param max: uint32_t, the maximum element possible + @param numberBins: uint8_t, the number of bins to categorize ranges of + elements + @return std::vector: a vector of bins +*/ +std::vector +generateUniformDistribution(std::uint32_t howMany, std::uint32_t min, + std::uint32_t max, std::uint8_t numberBins); +/* + @param howMany: uint32_t, the length of the random sequence + @param mean: float, the center of the normal distribution + @param stdev: float, the standard deviation of the normal distribution + @param numberBins: uint8_t, the number of bins to categorize ranges of + elements + @return std::vector, a vector of bins +*/ +std::vector +generateNormalDistribution(std::uint32_t howMany, float mean, float stdev, + std::uint8_t numberBins); +/* + @param howMany: uint32_t, the length of the random sequence + @param howOften: uint8_t, the mean of the Poisson distribution + @param numberBins: uint8_t, the number of bins to categorize ranges of + elements + @return std::vector, a vector of bins +*/ +std::vector +generatePoissonDistribution(std::uint32_t howMany, std::uint8_t howOften, + std::uint8_t numberBins); + +#endif // DISTRIBUTIONS_HPP \ No newline at end of file -- cgit v1.3