demo/simann_maxcut_demo.cc
changeset 2242 16523135943d
parent 1956 a055123339d5
child 2386 81b47fc5c444
     1.1 --- a/demo/simann_maxcut_demo.cc	Fri Oct 13 15:10:50 2006 +0000
     1.2 +++ b/demo/simann_maxcut_demo.cc	Sat Oct 14 15:26:05 2006 +0000
     1.3 @@ -54,7 +54,7 @@
     1.4      Entity(Graph& _g, Graph::EdgeMap<int>& _w) : g(_g), w(_w), a(_g) {}
     1.5      double mutate() {
     1.6        static const int node_num = countNodes(g);
     1.7 -      int i = 1 + (int) (node_num * (rand() / (RAND_MAX + 1.0)));
     1.8 +      int i = 1 + rnd[node_num];
     1.9        NodeIt n(g);
    1.10        int j = 1;
    1.11        while (j < i) {
    1.12 @@ -91,7 +91,7 @@
    1.13        for (NodeIt n(g); n != INVALID; ++n)
    1.14          a[n] = false;
    1.15        for (NodeIt n(g); n != INVALID; ++n)
    1.16 -        if (rand() < 0.5) a[n] = true;
    1.17 +        if (rnd.boolean(0.5)) a[n] = true;
    1.18        sum = 0;
    1.19        for (EdgeIt e(g); e != INVALID; ++e)
    1.20          if (a[g.source(e)] != a[g.target(e)])