I am Charmie

メモとログ

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: [code lang="cpp"] // 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; [/code]