This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Where is random()?


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~

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@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".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]