Thread: Help me understand this code...

  1. #1
    Registered User
    Join Date
    Feb 2009

    Help me understand this code...

    I want to make sure i understand what the following code is doing:
    #include <math.h>
         float expdev(long *idum) {
                   float ran0(long *idum);
                   float dummy;
                  while (dummy == 0.0);
                 return -log(dummy);
    So when someone calls on expdev, passing in idum, the value of idum is changed via ran0 correct? so if idum is 3 to start out with and runs once, the 2nd run of this function will have a different idum value right?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    ran0 can change the value pointed to by idum, yes; whether it does or not, who knows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM