COIN-OR::LEMON - Graph Library

Changeset 2242:16523135943d in lemon-0.x for demo


Ignore:
Timestamp:
10/14/06 17:26:05 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2991
Message:

New random interface
Switching to the new interface

Location:
demo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • demo/descriptor_map_demo.cc

    r2207 r2242  
    3333#include <lemon/graph_to_eps.h>
    3434
     35#include <lemon/random.h>
     36
    3537#include <iostream>
    3638
    37 #include <cstdlib>
    3839#include <cmath>
    39 #include <ctime>
     40
    4041
    4142using namespace lemon;
     
    7677
    7778int main() {
    78   std::srand(std::time(0));
    7979  typedef ListGraph Graph;
    8080  typedef Graph::Node Node;
     
    106106  const int EDGE = (int)(NODE * std::log(double(NODE)));
    107107  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];
    110110     
    111111    graph.addEdge(nodeInv[si], nodeInv[ti]);
  • demo/simann_maxcut_demo.cc

    r1956 r2242  
    5555    double mutate() {
    5656      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];
    5858      NodeIt n(g);
    5959      int j = 1;
     
    9292        a[n] = false;
    9393      for (NodeIt n(g); n != INVALID; ++n)
    94         if (rand() < 0.5) a[n] = true;
     94        if (rnd.boolean(0.5)) a[n] = true;
    9595      sum = 0;
    9696      for (EdgeIt e(g); e != INVALID; ++e)
  • demo/topology_demo.cc

    r2207 r2242  
    185185
    186186int main() {
    187   srand(time(0));
    188 
    189187  drawConnectedComponents();
    190188  drawStronglyConnectedComponents();
Note: See TracChangeset for help on using the changeset viewer.