source: trunk/test/rnd_test.cc @ 301

Last change on this file since 301 was 301, checked in by Peter, 17 years ago

modified includes in tests

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 632 bytes
Line 
1// $Id: rnd_test.cc 301 2005-04-30 13:39:27Z peter $
2
3#include <iostream>
4#include <c++_tools/utility/random_singleton.h>
5
6
7using namespace theplu;
8
9int main()
10{
11  utility::random_singleton* my_rnd;
12  my_rnd = utility::random_singleton::get_instance( -1 );
13 
14  double* prob = new double[ 5 ];
15  prob[ 0 ] = 0.2; 
16  prob[ 1 ] = 0.2;
17  prob[ 2 ] = 0.2;
18  prob[ 3 ] = 0.2;
19  prob[ 4 ] = 0.2;
20  my_rnd->set_general_distribution_prob( 5, prob );
21  delete prob;
22
23  int antal[5];
24  antal[ 0 ] = 0;
25  antal[ 1 ] = 0;
26  antal[ 2 ] = 0;
27  antal[ 3 ] = 0;
28  antal[ 4 ] = 0;
29
30  for( size_t i = 0; i < 100; ++i )
31    antal[ my_rnd->get_rnd_discrete() ]++;
32
33  delete my_rnd;
34
35  return 0;
36}
Note: See TracBrowser for help on using the repository browser.