Re: a flat distribution

From: JosephWu (wutongjoe_at_hotmail.com)
Date: 09/07/04


Date: Tue, 7 Sep 2004 12:49:30 +0000 (UTC)

Joseph <wutongjoe@hotmail.com> wrote in news:Xns955DD25F0B224wutongjoe@
203.96.216.21:

> I have following code which I want to generate random numbers of a flat
> distribution but something wrong with my code ,it does output in the
> range 1-12
>
> ========================
> #include <gsl/gsl_rng.h>
> #include <gsl/gsl_randist.h>
>
> int main (void)
> {
> const gsl_rng_type * T;
> gsl_rng * r;
>
> r = gsl_rng_alloc (gsl_rng_mt19937);
> for (int i = 0; i < 10; i++)
> {
>
> double v = gsl_ran_flat(r, 1,12);
> printf("number is %d\n ",v);
>
> }
>
> gsl_rng_free (r);
>
> return 0;
> }
>
> =========================
>
> is it possible to be the compliation pramater's problem ?
>
> I use: g++ filename -lgsl -lgslcblas -lm
>
>
>
>
>
> Thanks a lot!!

I found out that the default lib dir is /usr/local/lib but on my linux
(Mandrake 10) the lib files are all installed in the /usr/lib

how can i point the compiler to the dir where it could seek for the lib
files?

the topic is covered here
http://www.gnu.org/software/gsl/manual/gsl-ref_2.html#SEC11

which in most case I need to do like this:
gcc demo.c -lgsl -lgslcblas -lm (found
here:http://www.gnu.org/software/gsl/manual/gsl-ref_19.html#SEC325)

the GSL reference manual says that I need to create the path for lib
files(http://www.gnu.org/software/gsl/manual/gsl-ref_2.html#SEC12)

how can I do that ?
am I on the right way for the solution of my code ?

Thanks a lot



Relevant Pages