C++ class: Random Value Generator

I implemented a set of random value generator classes and the code is on my github repository

The class is used as follows:

// int Uniform distribution [0,100]
RandomUniformInt ui(0, 10);
// double Normal distribution N(0.5, 1.5)
RandomNormal<double> normal(0.5, 1.5);
for(int n = 0; n < 100; ++n)
{
    std::cout << ui.gen() << ", " << normal.gen() << std::endl;
}
std::cout << std::endl;
int size = 100;
std::vector<int> vui = ui.gen(size);
std::vector<double> vn = normal.gen(size);
for(int n = 0; n < size; ++n)
{
    std::cout << vui[n] << ", " << vn[n] << std::endl;;
}
std::cout << std::endl;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s