Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com From: Teun Burgers Subject: Re: drand48() (and erand48) returns only zeros Date: Fri, 12 Nov 2004 19:35:29 +0100 Lines: 20 Message-ID: References: <20041112154151 DOT 37720 DOT qmail AT web52604 DOT mail DOT yahoo DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet AT sea DOT gmane DOT org X-Gmane-NNTP-Posting-Host: 84-104-25-136.cable.quicknet.nl User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) In-Reply-To: <20041112154151.37720.qmail@web52604.mail.yahoo.com> X-IsSubscribed: yes meadmaker1066-cyg AT yahoo DOT com wrote: > drand48 and erand48 return only 0.0 no matter how many > times I call them. Indeed. Calling srand48 to set the seed helps, but should not be necessary. Teun #include #include int main(int argc, char *argv[]) { int i; srand48(0); for (i = 0; i< 20; i++) { printf("%3d %g\n", i, drand48()); } } -- 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/