3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
20 #include<lemon/random.h>
21 #include<lemon/time_measure.h>
23 using namespace lemon;
57 inline void f_random()
63 inline void f_drand48()
74 inline void f_rnd_int1000()
79 inline void f_rnd_bool()
97 const double TEST_DURATION=10;
99 t=runningTimeTest(f_no,2,&n,&full);
101 t=runningTimeTest(f_no,TEST_DURATION,&n,&full);
102 std::cout << "EMPTY: ";
103 std::cout << t.userTime() << " (" << n << " tests)\n";
105 t=runningTimeTest(f_noi,TEST_DURATION,&n,&full);
106 std::cout << "INLINED EMPTY: ";
107 std::cout << t.userTime() << " (" << n << " tests)\n";
109 TimeStamp ti=t=runningTimeTest(f_i,TEST_DURATION,&n,&full);
110 std::cout << "INT COPY: ";
111 std::cout << t.userTime() << " (" << n << " tests)\n";
113 TimeStamp tl=t=runningTimeTest(f_l,TEST_DURATION,&n,&full);
114 std::cout << "LONG COPY: ";
115 std::cout << t.userTime() << " (" << n << " tests)\n";
117 TimeStamp td=t=runningTimeTest(f_d,TEST_DURATION,&n,&full);
118 std::cout << "DOUBLE COPY: ";
119 std::cout << t.userTime() << " (" << n << " tests)\n";
121 t=runningTimeTest(f_rand,TEST_DURATION,&n,&full);
122 std::cout << "rand(): ";
123 std::cout << (t-ti).userTime() << " (" << n << " tests)\n";
125 t=runningTimeTest(f_random,TEST_DURATION,&n,&full);
126 std::cout << "random(): ";
127 std::cout << (t-tl).userTime() << " (" << n << " tests)\n";
129 t=runningTimeTest(f_drand48,TEST_DURATION,&n,&full);
130 std::cout << "drand48(): ";
131 std::cout << (t-td).userTime() << " (" << n << " tests)\n";
133 t=runningTimeTest(f_rnd_d,TEST_DURATION,&n,&full);
134 std::cout << "rnd(): ";
135 std::cout << (t-td).userTime() << " (" << n << " tests)\n";
137 t=runningTimeTest(f_rnd_int1000,TEST_DURATION,&n,&full);
138 std::cout << "rnd[1000]: ";
139 std::cout << (t-ti).userTime() << " (" << n << " tests)\n";
141 t=runningTimeTest(f_rnd_bool,TEST_DURATION,&n,&full);
142 std::cout << "rnd.boolean(): ";
143 std::cout << (t-ti).userTime() << " (" << n << " tests)\n";
145 // t=runningTimeTest(f_,TEST_DURATION,&n,&full);
146 // std::cout << "\n";
147 // std::cout << t << " (" << n << " tests)\n";
148 // std::cout << "Total: " << full << "\n\n";