From: hgfernan AT usp DOT br (Hilton Fernandes) Subject: Re: Where is random()? 15 Dec 1998 10:21:34 -0800 Message-ID: <199812150312.BAA15267.cygnus.gnu-win32@swan2.uspnet.usp.br> References: <3673E58E DOT 93F1B604 AT fel DOT cvut DOT cz> Reply-To: Hilton Fernandes Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT To: Jan Tomasek , gnu-win32 AT cygnus DOT com Cc: "Hilton Fernandes" , Hilton Fernandes On 13 Dec 98 at 16:04, Jan Tomasek wrote: > Hi, > I'm writing one school project in C and at home I working > under CygWin 19.2 > > On my Linux (Debian) is on random() man page writen that it is in > defined in stdlib.h > * if I compile it with gcc on that linux all is ok > * if I compile it with Cygnus gcc port I get warning: > > In file included from sftpx.c:11: > ftpx.c:9: warning: implicit declaration of function `random' > > Program is working correctly, I thing that random is hiden in > some .a library. > > Does someone here known where is random definition? > > Thanks > -- > Jan Tomasek, student FEL-CVUT > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > e-mail: xtomasej AT fel DOT cvut DOT cz www: > http://mujweb.cz/web/tomasek/ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~H~ Hello! Sorry to tell you, but random() isn't standard. Neither randomize() is. You should use void srand (unsigned int); to start the (pseudo) random number generator and get the (pseudo) random numbers with int rand (void); Both are defined in stdlib.h in any ANSI compliant compiler. Sometimes the standard (pseudo) random number generators don't behave in a statiscally random fashion, so people try to use enhanced algorithms. If you trust Debian's algorithm and think it's better than the standard one in CygWin, then you should get (LGPL>) Debian's source of them at http://www.debia.org and compile it using CygWin tools. If it is really a better algorithm and Cygnus accepts including it in a next version, you'll be doing every CygWin user a good favor. Best regards, --Hilton ------------------- Hilton Fernandes, M. Sc email: hgfernan AT usp DOT br Parallel Distributed Applications at Escola Politecnica (Polytechnic School) University of S. Paulo - Brazil - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".