1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <random>
#include <string>
#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<DistributionPair>&, 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<DistributionPair>& 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<DistributionPair>: a vector of bins
*/
std::vector<DistributionPair>
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<DistributionPair>, a vector of bins
*/
std::vector<DistributionPair>
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<DistributionPair>, a vector of bins
*/
std::vector<DistributionPair>
generatePoissonDistribution(std::uint32_t howMany, std::uint8_t howOften,
std::uint8_t numberBins);
#endif // DISTRIBUTIONS_HPP
|