Changeset 2242:16523135943d in lemon-0.x for demo
- Timestamp:
- 10/14/06 17:26:05 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2991
- Location:
- demo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
demo/descriptor_map_demo.cc
r2207 r2242 33 33 #include <lemon/graph_to_eps.h> 34 34 35 #include <lemon/random.h> 36 35 37 #include <iostream> 36 38 37 #include <cstdlib>38 39 #include <cmath> 39 #include <ctime> 40 40 41 41 42 using namespace lemon; … … 76 77 77 78 int main() { 78 std::srand(std::time(0));79 79 typedef ListGraph Graph; 80 80 typedef Graph::Node Node; … … 106 106 const int EDGE = (int)(NODE * std::log(double(NODE))); 107 107 for (int i = 0; i < EDGE; ++i) { 108 int si = (int)(std::rand() / (RAND_MAX + 1.0) * NODE);109 int ti = (int)(std::rand() / (RAND_MAX + 1.0) * NODE);108 int si = rnd[NODE]; 109 int ti = rnd[NODE]; 110 110 111 111 graph.addEdge(nodeInv[si], nodeInv[ti]); -
demo/simann_maxcut_demo.cc
r1956 r2242 55 55 double mutate() { 56 56 static const int node_num = countNodes(g); 57 int i = 1 + (int) (node_num * (rand() / (RAND_MAX + 1.0)));57 int i = 1 + rnd[node_num]; 58 58 NodeIt n(g); 59 59 int j = 1; … … 92 92 a[n] = false; 93 93 for (NodeIt n(g); n != INVALID; ++n) 94 if (r and() < 0.5) a[n] = true;94 if (rnd.boolean(0.5)) a[n] = true; 95 95 sum = 0; 96 96 for (EdgeIt e(g); e != INVALID; ++e) -
demo/topology_demo.cc
r2207 r2242 185 185 186 186 int main() { 187 srand(time(0));188 189 187 drawConnectedComponents(); 190 188 drawStronglyConnectedComponents();
Note: See TracChangeset
for help on using the changeset viewer.