#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double ran_expo(lambda){
    double u;
    u = rand() / (RAND_MAX + 1.0);
    return -log(1- u) / lambda;
}
I am using this (I do not put other parts of the codes here) to generate random numbers of an exponential distribution lambda = 0.05. (Probability density function being lambda * exp(-lambda * x)).
However, I always get very small numbers, such as  0.000041, or something like 1.#INF00 (what is this?). 
In fact, for exponential distribution with lambda = 0.05, numbers generated should be quite large, namely most are not far from 30. My results are very weird. In addition, the degree of precision is not satisfactory, only to 10^(-6). I tried long double, but it is still like this.
I am using DEV C++ under windows.
 
     
    