Date: Sun, 02 Feb 2003 12:39:50 -0800 From: Bakul Shah <bakul@bitblocks.com> To: Edward Brocklesby <ejb@lythe.org.uk> Cc: current@FreeBSD.ORG Subject: Re: rand() is broken Message-ID: <200302022039.PAA13951@warspite.cnchost.com> In-Reply-To: Your message of "Sun, 02 Feb 2003 20:18:11 GMT." <200302022018.h12KIC1a008066@a.smtp.serv.lythe.org.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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 <stdlib.h> #include <stdio.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302022039.PAA13951>