Subject: Re: Where is random()?
From: [email-masked] (Hilton Fernandes)

15 Dec 1998 10:21:34 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: Hilton Fernandes <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7BIT
To: Jan Tomasek <[email-masked]>, [email-masked]
Cc: "Hilton Fernandes" <[email-masked]>,
        Hilton Fernandes <[email-masked]>

On 13 Dec 98 at 16:04, Jan Tomasek <[email-masked]> 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: [email-masked] 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: [email-masked]
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
"[email-masked]" with one line of text: "help".