From owner-freebsd-current Sun Mar 31 14:50:14 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id OAA05318 for current-outgoing; Sun, 31 Mar 1996 14:50:14 -0800 (PST) Received: from sovcom.kiae.su (sovcom.kiae.su [144.206.136.1]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id OAA05308 for ; Sun, 31 Mar 1996 14:50:06 -0800 (PST) Received: by sovcom.kiae.su id AA25035 (5.65.kiae-1 ); Mon, 1 Apr 1996 01:46:06 +0300 Received: by sovcom.KIAE.su (UUMAIL/2.0); Mon, 1 Apr 96 01:46:05 +0300 Received: (from ache@localhost) by astral.msk.su (8.7.5/8.7.3) id CAA01491; Mon, 1 Apr 1996 02:33:26 +0400 (MSD) Message-Id: <199603312233.CAA01491@astral.msk.su> Subject: Re: random .. not so .. To: bde@zeta.org.au (Bruce Evans) Date: Mon, 1 Apr 1996 02:33:25 -4400 (MSD) Cc: bde@zeta.org.au, current@FreeBSD.org, davidg@Root.COM, imb@scgt.oz.au In-Reply-To: <199603310320.NAA08023@godzilla.zeta.org.au> from "Bruce Evans" at "Mar 31, 96 01:20:26 pm" From: =?KOI8-R?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= (aka Andrey A. Chernov, Black Mage) X-Class: Fast X-Mailer: ELM [version 2.4ME+ PL14 (25)] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > >Calling srandom(time() f.e.) is common case. Without this fix two > >programs calling srandom in _different_ times produces very predictable > >almost same sequences. > > This must be a poor way to initialize random(). First, time() isn't > random. Second, srandom() isn't claimed to give a state that varies > randomly with its arg. In fact, it doesn't. Seed isn't supposed to be random at all, it must be just DIFFERENT. Seeding can be treated as some sort of one way function (like MD5) where different initial number produces different random sequence. BTW, proposed formula doesn't do any harm even from different points of view on seed nature. -- Andrey A. Chernov : And I rest so composedly, /Now, in my bed, ache@astral.msk.su : That any beholder /Might fancy me dead - http://dt.demos.su/~ache : Might start at beholding me, /Thinking me dead. RELCOM Team,FreeBSD Team : E.A.Poe From "For Annie" 1849