avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] rand(3) in avr-libc


From: Joerg Wunsch
Subject: [avr-libc-dev] rand(3) in avr-libc
Date: Mon, 9 Sep 2002 16:13:55 +0200
User-agent: Mutt/1.2.5i

Hi all,

after looking at FreeBSD's rand.c implementation, i noticed that
avr-libc already has one, apparently taken from FreeBSD's revision
1.2.  This file has an implementation for thread support (rand_r())
which we IMHO don't need, while it doesn't use the improved algorithm
that is used in random(3), as implemented in FreeBSD's rev 1.3 (which
is much preferrable, as i understand it).

Also, RAND_MAX was set to 0x7fffffff, but the return type is only int
(which is unfortunately mandated by the ISO C standard).  This doesn't
fit very well...

Finally, only RAND_MAX was really in <stdlib.h> by now, while rand()
and srand() aren't documented.

I'll append a diff for the improved version minus support for
rand_r(), plus the documentation.

Opinions anyone?  Should i keep rand_r() support?
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/

Attachment: libc-rand.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]