test/random_test.cc
changeset 169 5b507a86ad72
parent 92 5d4decd1b870
child 171 02f4d5d9bfd7
equal deleted inserted replaced
2:41af1215095b 3:cb3005fc1f7a
    22 ///\file \brief Test cases for random.h
    22 ///\file \brief Test cases for random.h
    23 ///
    23 ///
    24 ///\todo To be extended
    24 ///\todo To be extended
    25 ///
    25 ///
    26 
    26 
       
    27 int seed_array[] = {1, 2};
       
    28 
    27 int main()
    29 int main()
    28 {
    30 {
    29   double a=lemon::rnd();
    31   double a=lemon::rnd();
    30   check(a<1.0&&a>0.0,"This should be in [0,1)");
    32   check(a<1.0&&a>0.0,"This should be in [0,1)");
    31   a=lemon::rnd.gauss();
    33   a=lemon::rnd.gauss();
    32   a=lemon::rnd.gamma(3.45,0);
    34   a=lemon::rnd.gamma(3.45,0);
    33   a=lemon::rnd.gamma(4);
    35   a=lemon::rnd.gamma(4);
    34   //Does gamma work with integer k?
    36   //Does gamma work with integer k?
    35   a=lemon::rnd.gamma(4.0,0);
    37   a=lemon::rnd.gamma(4.0,0);
    36   a=lemon::rnd.poisson(.5);
    38   a=lemon::rnd.poisson(.5);
       
    39 
       
    40   lemon::rnd.seed(100);
       
    41   lemon::rnd.seed(seed_array, seed_array + 
       
    42 		  (sizeof(seed_array) / sizeof(seed_array[0])));
       
    43 
       
    44   return 0;
    37 }
    45 }