Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Feb 2003 20:18:11 +0000
From:      Edward Brocklesby <ejb@lythe.org.uk>
To:        Bakul Shah <bakul@bitblocks.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: rand() is broken
Message-ID:  <200302022018.h12KIC1a008066@a.smtp.serv.lythe.org.uk>
In-Reply-To: <200302022006.PAA25355@valiant.cnchost.com>
References:  <200302022006.PAA25355@valiant.cnchost.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 02 February 2003 8:06 pm, Bakul Shah wrote:
> > Maybe I missed something, but why cannot you just rip random() from libc,
> > rename it to bakul_shah_random() and use that in your testing code?  Then
> > you are safe from any changes to random(), and indeed have a portable RNG
> > if your host OS changes.
>
> Yes, *I* can do it but I don't work at every place they do
> simulation!  If in the extreme you are suggesting that a
> portable application shouldn't rely on any OS features,

No, that wasn't what I meant;  yes, there are things should be able to rely 
on not changing between platforms, however ...

> The point of compatibility is to
> not break interfaces unless there is a significant benefit.

... I think there is more than one level of 'compatibility'; I for one would 
not expect random() to return the same results across platforms, certainly, 
or even between seperate releases of one platform, even though its API may be 
the same.  For two reasons, mainly, the first that you know someone will 
change it somewhere anyway ;-), and second I think that's placing too much of 
a restriction on the OS.  If FreeBSD makes random2() using RC4 to avoid 
changing rand() or random(), will people then start relying on random2()'s 
behaviour, and when someone finds a problem in RC4, then the next will be 
random3()?

If you require <x> implementation of random(), then I don't think that it's 
so bad that you should be expected to provide it yourself, rather than 
assuming this is what the OS uses.  But then maybe this comes down to 
difference of opinion.

Would you have a problem with changes in the TCP/IP stack changing the 
content of packets sent out when you connect(), if it breaks your TCP/IP 
simulations?


Regards,
Edward.

(PS: Even though it's rand(), not random() being changed, I think this issue 
applies to both..)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302022018.h12KIC1a008066>