[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c library functions



Assa Paran <assa@lxtani.math.technion.ac.il> writes:

> Hello
> As a newbie to linux ,at least as a programmer 
> I need to know where to find documentation ( like help ) 
> of c library functions ,espacailly ANSI compatible.

On paper: "The Standard C Library" by Plauger, Prentice Hall

On line: start with man -- see "man man" for usage, "man rand"
should give you the rand(3) man page.

> It appears that the rand() function (stdlib.h)which is documented in 
> Reachy & Kranigen is ANSI .

Kernighan & Ritchie? ;-) 

> It is supposed to return 0 - MAX  whence MAX is implementation
> dependant.

>From 0 to RAND_MAX, with RAND_MAX at least 32767

> In my linux ( a 1996 version of slackware ) it returned negative values.

Weird. 

1) I suppose you wrote a 3-line driver to rand(3) so nothing else
   junks the output. 

2) What version of libc are you using?

3) A word of warning: while rand(3) is relatively fast, it is not very
   random (even though the GNU/Linux implementation is better than
   many others). If you plan to do serious simulations I suggest you look
   elsewhere. I don't know if it is any good for cryptography.

-- 
Oleg Goldshmidt          goldshmt@netvision.net.il   
BLOOMBERG L.P. (BFM)     oleg@bfr.co.il

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il