From owner-freebsd-current Sun Feb 2 12:39:59 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C7C0F37B401 for ; Sun, 2 Feb 2003 12:39:57 -0800 (PST) Received: from warspite.cnchost.com (warspite.concentric.net [207.155.248.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3DD8D43F3F for ; Sun, 2 Feb 2003 12:39:57 -0800 (PST) (envelope-from bakul@bitblocks.com) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by warspite.cnchost.com id PAA13951; Sun, 2 Feb 2003 15:39:50 -0500 (EST) [ConcentricHost SMTP Relay 1.15] Message-ID: <200302022039.PAA13951@warspite.cnchost.com> To: Edward Brocklesby Cc: current@FreeBSD.ORG Subject: Re: rand() is broken In-reply-to: Your message of "Sun, 02 Feb 2003 20:18:11 GMT." <200302022018.h12KIC1a008066@a.smtp.serv.lythe.org.uk> Date: Sun, 02 Feb 2003 12:39:50 -0800 From: Bakul Shah Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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()? What I am suggesting is to leave random() as it is and guarantee its behavior won't change and add cryto_random() or whatever, and indicate it *may* change. > 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? This is not a similar situation. Note that it is rand() that is broken, not random() as can be seen by modifying Kris Kennaways' test so I don't see why Mark Murray was talking about changing it in the first place. #include #include int main() { int i; for(i = 1; i <= 1000; i++) { srandom(i); printf("%d: %d\n", i, random()); } } 1: 1804289383 2: 1505335290 3: 1205554746 4: 1968078301 5: 590011675 6: 290852541 7: 1045618677 8: 757547896 9: 444454915 10: 1215069295 11: 1989311423 12: 1687063760 13: 1358590890 14: 2146406683 15: 762299093 16: 462648444 17: 1227918265 ... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message