Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Apr 1996 02:33:25 -4400 (MSD)
From:      =?KOI8-R?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= (aka Andrey A. Chernov, Black Mage) <ache@astral.msk.su>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        bde@zeta.org.au, current@FreeBSD.org, davidg@Root.COM, imb@scgt.oz.au
Subject:   Re: random .. not so ..
Message-ID:  <199603312233.CAA01491@astral.msk.su>
In-Reply-To: <199603310320.NAA08023@godzilla.zeta.org.au> from "Bruce Evans" at "Mar 31, 96 01:20:26 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> >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



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