On Fri, 12 Nov 2004, meadmaker1066-cyg wrote:

> drand48 and erand48 return only 0.0 no matter how many
> times I call them. The code works fine on the Linux
> computers at school, and the compiler does not report
> any errors or warnings.
> [anip]
>
> #include <stdlib.h>
> #include <cmath>
>
> #include <iostream>
           ^^^^^^^^^^
If you're using C++, why use stdio functions?

> using namespace std;
>
> ...
>
> for(int i=0; i<10; i++){
>   printf("%f\n",drand48());

In any case, try

   printf("%lf\n",drand48());
            ^

> }
>
> In CygWin it produces a chain of 10 values "0.00000"
> but in Linux it produces a chain of random numbers. If
> I define an array of unsigned short integers and pass
> it to erand48 I get the same behavior (I thought maybe
> drand might be just resetting its internal storage).

HTH,
        Igor
-- 
                                http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_                [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            [EMAIL PROTECTED]
     |,4-  ) )-,_. ,\ (  `'-'           Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to