Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > a flat distribution

Reply
Thread Tools

a flat distribution

 
 
Joseph
Guest
Posts: n/a
 
      09-07-2004
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!!
 
Reply With Quote
 
 
 
 
JosephWu
Guest
Posts: n/a
 
      09-07-2004
Joseph <(E-Mail Removed)> 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/manu...f_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/manu...19.html#SEC325)

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

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

Thanks a lot
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting 'flat' gate level names to hierarchical names Paddy McCarthy VHDL 3 09-24-2004 05:34 PM
flat dropdownlist olivier ASP .Net 3 12-05-2003 02:24 PM



Advertisments