Hi everybody
I use Dev-C++ and have installed GSL with a DevPak.
I have copied the headers and libraries and made links with Dev-C++.
I would like to generate random numbers (gaussian law)
I use this code:
------------------------------------------
#include <stdlib.h>
#include <ctime>
#include <iostream>
#include <time.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
using std::cout;
using std::endl;
int main(int argc, char *argv[]) {
gsl_rng *r = r;
r = gsl_rng_alloc(gsl_rng_mt19937);
gsl_rng_set(r, time(NULL));
double sigma = 1;
cout << "Loi de Gauss avec sigma= " << sigma << endl;
for(int i = 0; i < 20; i++)
cout << i << " : " << gsl_ran_gaussian(r, sigma) << endl;
gsl_rng_free(r);
------------------------------------------
The code seams to compile correctly but when I execute the *.exe, I got a
segmentation error.
I have searched where the program stops and it seams that the error appears
while executing
r = gsl_rng_alloc(gsl_rng_mt19937);
Do you know how to solve my mysterioux problem?
Thank you very much
xavier
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl