Ejemplo n.º 1
0
int main() {
    MTRand mtrand = MTRand();
    for (int i = 0; i < 20; i++ ) {
        cout << i << endl;
        Network net("test", false );
        net.populate(N_NODES);
	    //cout << net.size() << " ";
        //net.erdos_renyi(4);
        net.rand_connect_poisson(10);
//        sleep(5);
        //cout << net.mean_deg() << endl;
        //cout << net.transitivity(net.get_nodes()) << endl;
        //vector<Node*> comp = net.get_major_component();
        //cout << comp.size() << endl;
        //net.graphviz("");
/*	    
	    vector<Node*> my_nodes = net.get_nodes();
	    my_nodes[1] = my_nodes[2];
	    vector<Node*> your_nodes = net.get_nodes();
	    if (my_nodes[1] == your_nodes[2]) cerr << "Yikes!!\n";
	   
	    for (int i = 0; i < N_NODES; i++) {
	        net.get_node(i)->mean_min_path();
	        cout << i << " mean dist: " << setprecision(10) << net.get_node(i)->mean_min_path() << endl;
	        vector<int> distances = net.get_node(i)->min_paths();        
	        cout << i << " to 1 " << distances[1] << endl;
	    }*/
    }
return 0;
}
int main(int argc,char *argv[]){
	//Initializes random number generator
	GLOBAL_mtrand = MTRand(37);

	//Reads in command line input
	InputParser *input=new InputParser(argc,argv);
	glutInit(&argc, argv);
	
	//Loads mesh and intializes raytracer
	Mesh *mesh=new Mesh();
	mesh->LoadInput(input->input_file,input);
	RayTracer *raytracer= new RayTracer(mesh,input);

	//Starts previwer and opens window
	Canvas::initialize(input,mesh,raytracer);

	//Never reachs here
	return 0;
}
Ejemplo n.º 3
0
int main(int argc, char *argv[]) {

  // deterministic (repeatable) randomness
  // GLOBAL_mtrand = MTRand(37);
  // "real" randomness
  GLOBAL_mtrand = MTRand((unsigned)time(0));
  //
  
  ArgParser args(argc, argv);
  Mesh mesh(&args);
  Hemisphere hemisphere(&mesh, 10, 30);
  Forest forest(&args, &hemisphere);

  mesh.Load(args.input_file);
  glutInit(&argc,argv);
  GLCanvas::initialize(&args,&mesh,&hemisphere,&forest); 

  return 0;
}
Ejemplo n.º 4
0
void seed(const unsigned long val)
{
    mt_rand = MTRand(val);
}
Ejemplo n.º 5
0
 *
 *  Created by Jim Mainprice on 03/06/10.
 *  Copyright 2010 LAAS/CNRS. All rights reserved.
 *
 */
#include "P3d-pkg.h"

#include <cassert>
#include "MTRand.hpp"

#ifdef USE_GSL
#include <gsl/gsl_randist.h>
gsl_rng * _gsl_seed;
#endif

MTRand mersenne_twister_rng = MTRand(time(NULL));

/***********************************************/
/* Fonction initialisant le generateur de      */
/* nombres aleatoires par un nombre choisi     */
/* In : l'initialisation                       */
/* Out :                                       */
/***********************************************/
void p3d_init_random_seed(int seed)
{
  // SHOULD THAT BE IN THERE ?? (TRO deadline 2016)
  std::srand((unsigned int) (seed)); // C library implementation
	mersenne_twister_rng.seed(seed);
#ifdef USE_GSL
	_gsl_seed = gsl_rng_alloc (gsl_rng_taus);
#endif