Where is random()?

Hilton Fernandes hgfernan@usp.br
Mon Dec 14 23:25:00 GMT 1998

On 13 Dec 98 at 16:04, Jan Tomasek <xtomasej@fel.cvut.cz> 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@fel.cvut.cz www:
>                             http://mujweb.cz/web/tomasek/  
>                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~H~


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 


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 Fernandes, M. Sc
email: hgfernan@usp.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@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list