Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > drand48() where is it?

drand48() where is it?
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jun 30, 2002, 11:36 AM
 
I'm calling out to all of those C++ programmers out there.

Does anyone know where the 'drand48()' function that's normally part of the stdlib.h is? I'm trying to compile a program using it and I always get the same message:

util.cpp: In function `double drand()':
util.cpp:30: implicit declaration of function `int drand48(...)'

Has 'drand48()' been removed from the stdlib.h? Has it been replaced? If so, what's the new function? If not, where can I get it?

Any ideas?

BTW: Here is the source code I'm working with:

#ifdef _WIN32
double drand() {
int ival;
double val;
ival = irand();
val = (double)ival/(RAND_MAX + 1);
ival = irand();
val = ((double)ival + val)/(RAND_MAX + 1);
return(val);
}
#else
double drand() {
double val;
val = drand48(); //<--Line 30
return val;
}
#endif
PowerBook G4 800Mhz
1GB RAM
60GB 7200rpm Hard Drive
Running Tiger
     
   
Thread Tools
Forum Links
Forum 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 On
Top
Privacy Policy
All times are GMT -5. The time now is 09:55 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2