473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to include "uniform_real" class of libstdc++

Hi everyone,

I am relatively new to C++ and trying to write a program during which I need to generate random numbers with uniform distribution.
On g++'s site - the compiler I am using - (version 4.1.3) it is written that there is a library called "libstdc++" which is built in the g++. I also checked that the libstdc++ v3 package is really installed on my system (i'm using ubuntu linux) - and it is.

Accrodinf to libstc++ doucmentation there is a class in the library called uniform_real, but I cannot define instances of it - I always get an error that "uniform_real" is not defined.

I tried writing "using namespace std::tr1" at the beginning of the program but it didn't help either and I got an error "tr1 is not a valid namespace name"...

So how what I should do to make uniform_available? :)

Maybe there is a simpler way of generating uniform numbers that I don't know of?

Thanks in advance :)
Dec 3 '07 #1
3 2099
weaknessforcats
9,208 Expert Mod 8TB
You should really Google on this. I did and found that probably you need #include <boost/random/uniform_01.hpp> and use namespace boost.

However, since this is all non-ANS C++, I could be incorrect here.
Dec 3 '07 #2
You should really Google on this. I did and found that probably you need #include <boost/random/uniform_01.hpp> and use namespace boost.

However, since this is all non-ANS C++, I could be incorrect here.
I've googled a lot actually but found very little. Thanks anyway, what keywords did you use?
Unfortunately your solution didn't compile.. :(
Dec 3 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
I just used uniform_real.
Dec 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John C | last post by:
Hi, I am trying to include the generation of random numbers in my c++ class. However I don't quite know how to incorporate it. To start with, I managed to get random numbers going via the...
28
by: galathaea | last post by:
On Mar 2, 11:29 pm, galath...@veawb.coop (galathaea) wrote: still being very naive about this whole crackpot / crank thing i accidentally let the engineer inside think too hard about this ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.