473,508 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a flat distribution

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!!
Jul 22 '05 #1
1 1927
Joseph <wu*******@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/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
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
14238
by: Nicolas Girard | last post by:
Hi, Forgive me if the answer is trivial, but could you tell me how to achieve the following: {k1:,k2:v3,...} --> ,,,...] The subtle point (at least to me) is to "flatten" values that are...
699
33326
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
13
3396
by: raykyoto | last post by:
Hi all, I'm sure this is a popular question that comes up every few months here. Indeed, I've looked at some of the past postings, but I would like to ask things differently. Basically, I'm...
22
2977
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
4
2643
by: Dennis D. | last post by:
I want to construct a simple flat file, non-relational database within my windows application. It would be a simple table with fields contained in a separate file which accompanies the...
1
5578
by: Knepper, Michelle | last post by:
Hi out there, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I don't...
9
2180
by: FFMG | last post by:
In my site I have a config table, (MySQL), with about 30 entries; the data is loaded on every single page load. This is not the only call to the db, (we do a total of about 8 calls to the db). As...
2
6119
by: murthydb2 | last post by:
Hi My requirement is that i have to write a stored procedure in db2 and that will be executed in a batch file . Any system error or validation error that occurs inside the db2 sp during...
15
5238
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.