a flat distribution

Discussion in 'C++' started by Joseph, Sep 7, 2004.

  1. Joseph

    Joseph Guest

    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!!
    Joseph, Sep 7, 2004
    #1
    1. Advertising

  2. Joseph

    JosephWu Guest

    Joseph <> 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
    JosephWu, Sep 7, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paddy McCarthy
    Replies:
    3
    Views:
    708
    Anthony J Bybell
    Sep 24, 2004
  2. olivier

    flat dropdownlist

    olivier, Dec 4, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,176
    Infant Newbie
    Dec 5, 2003
  3. Mark Goldin

    Flat combo

    Mark Goldin, Aug 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    572
  4. Stefano Napafini

    Flat Style DropDownList

    Stefano Napafini, Sep 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    5,842
    Martijn Saly
    Sep 10, 2005
  5. Inspector

    flat file vs sql database

    Inspector, Nov 23, 2005, in forum: ASP .Net
    Replies:
    10
    Views:
    1,011
    Inspector
    Nov 25, 2005
Loading...

Share This Page