473,569 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to include "uniform_re al" class of libstdc++

2 New Member
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_re al" 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_availab le? :)

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

Thanks in advance :)
Dec 3 '07 #1
3 2108
weaknessforcats
9,208 Recognized Expert Moderator Expert
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
AndreyS
2 New Member
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 Recognized Expert Moderator Expert
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
6262
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 following... ============ #include <boost/random/linear_congruential.hpp> #include <boost/random/uniform_real.hpp> #include...
28
2637
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 since my degree is in physics simulations and my career is in programming and i happened to have a simulation generator i have been building i...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5222
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
944
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.