summaryrefslogtreecommitdiff
path: root/random-example.cpp
blob: 484bc6f23bf404403e4907ba7c265594c7cc300b (plain)
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
#include <iostream>
#include <random>

using namespace std;

int main()
{
	const int iterations = 1000;

	mt19937 gen;
	normal_distribution<double> norm(5.0,2.0);
	exponential_distribution<double> expo(3.5);
	negative_binomial_distribution<int> negbin(3,0.5);
	uniform_int_distribution<int> uint(0,9);
	uniform_real_distribution<double> ureal(0.0,5.0);


	cout << "x\t"
	     << "normal\t"
	     << "exponential\t"
	     << "Neg-Binomial\t"
	     << "Unif-Int\t"
	     << "Unif-Real"
	     << endl;

	for (int i=0;i<iterations;++i) {
		cout << (i+1) << "\t"
		     << norm(gen) << "\t"
		     << expo(gen) << "\t"
		     << negbin(gen) << "\t"
		     << uint(gen) << "\t"
		     << ureal(gen) << "\t"
		     << endl;
	}
	return 0;
}