I am new to programming in C and I'm trying to write a random number generator with a Gaussian distribution with user-defined mean and variance. I've looked at the code given in "Numerical Recipes in C" but I don't understand it very well. If anyone could point me in the direction of a tutorial or any other help it would be greatly appreciated.
mitzoff 0 Newbie Poster
Recommended Answers
Jump to Post>I get undefined refrecence errors relating to 'main' and the log and sqrt functions. I'm not
>sure why I'm getting these. I am using gcc in Linux.
I'll make an educated guess and say that you didn't link with the math library:$ gcc main.c -lm $ …
Jump to PostI have included math.h. I ran into the same problem when using acos to define pi in another program. When I replaced acos with atan it compiled and worked correctly.
Strange?
#include <stdio.h> #include <math.h> #include <string.h> int main ( void ) { float t = acos( …
All 8 Replies

GreenDay2001
ssharish2005 62 Posting Whiz in Training
mitzoff 0 Newbie Poster
ssharish2005 62 Posting Whiz in Training
Narue 5,707 Bad Cop Team Colleague
mitzoff 0 Newbie Poster
ssharish2005 62 Posting Whiz in Training

iamthwee
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.