random_number_generator.cpp
Go to the documentation of this file.
00001 
00009 /*****************************************************************************
00010  ** Includes
00011  *****************************************************************************/
00012 
00013 #include <iostream>
00014 #include "../../include/ecl/time/random_number_generator.hpp"
00015 
00016 /*****************************************************************************
00017  ** Main
00018  *****************************************************************************/
00019 
00020 int main()
00021 {
00022 
00023   ecl::RandomNumberGenerator<float> random_number_generator;
00024   int n = 5;
00025 
00026   std::cout << std::endl;
00027   std::cout << "***********************************************************" << std::endl;
00028   std::cout << "                   Uniform Numbers" << std::endl;
00029   std::cout << "***********************************************************" << std::endl;
00030   std::cout << std::endl;
00031 
00032   std::cout << "Default (0, 1):" << std::endl;
00033   for (int i = 0; i < n; ++i)
00034   {
00035     std::cout << "  " << random_number_generator.uniform();
00036   }
00037   std::cout << std::endl;
00038   for (int i = 0; i < n; ++i)
00039   {
00040     std::cout << "  " << random_number_generator.uniform();
00041   }
00042   std::cout << std::endl;
00043   std::cout << "Over Range (-5, 5): " << std::endl;
00044   for (int i = 0; i < n; ++i)
00045   {
00046     std::cout << "  " << random_number_generator.uniform(5.0);
00047   }
00048   std::cout << std::endl;
00049   for (int i = 0; i < n; ++i)
00050   {
00051     std::cout << "  " << random_number_generator.uniform(5.0);
00052   }
00053   std::cout << std::endl;
00054 
00055   std::cout << std::endl;
00056   std::cout << "***********************************************************" << std::endl;
00057   std::cout << "                      Guassian" << std::endl;
00058   std::cout << "***********************************************************" << std::endl;
00059   std::cout << std::endl;
00060 
00061   std::cout << "std = 1, avg = 0: " << std::endl;
00062   for (int i = 0; i < n; ++i)
00063   {
00064     std::cout << "  " << random_number_generator.gaussian(1.0);
00065   }
00066   std::cout << std::endl;
00067   for (int i = 0; i < n; ++i)
00068   {
00069     std::cout << "  " << random_number_generator.gaussian(1.0);
00070   }
00071   std::cout << std::endl;
00072 
00073   std::cout << "std = 1, avg = 3: " << std::endl;
00074   for (int i = 0; i < n; ++i)
00075   {
00076     std::cout << "  " << random_number_generator.gaussian(1.0, 3.0);
00077   }
00078   std::cout << std::endl;
00079   for (int i = 0; i < n; ++i)
00080   {
00081     std::cout << "  " << random_number_generator.gaussian(1.0, 3.0);
00082   }
00083   std::cout << std::endl;
00084 
00085   std::cout << "std = 3, avg = 5: " << std::endl;
00086   for (int i = 0; i < n; ++i)
00087   {
00088     std::cout << "  " << random_number_generator.gaussian(3.0, 5.0);
00089   }
00090   std::cout << std::endl;
00091   for (int i = 0; i < n; ++i)
00092   {
00093     std::cout << "  " << random_number_generator.gaussian(3.0, 5.0);
00094   }
00095   std::cout << std::endl;
00096 
00097   std::cout << std::endl;
00098   std::cout << "***********************************************************" << std::endl;
00099   std::cout << "                      Passed" << std::endl;
00100   std::cout << "***********************************************************" << std::endl;
00101   std::cout << std::endl;
00102   return 0;
00103 }


ecl_time
Author(s): Daniel Stonier
autogenerated on Mon Jul 3 2017 02:21:18