Re: alias wanted for binfmt_java

Olaf Titz (olaf@bigred.inka.de)
Wed, 29 May 96 10:08 MET DST


Newsgroups: linux.dev.kernel
Path: not-for-mail
From: Olaf Titz <olaf@bigred.inka.de>
Subject: Re: random() in kernel
Message-ID: <ds5qmk.fyn@bigred.inka.de>
Date: 29 May 1996 10:08:44 +0100
References: <199605271747.SAA08584@oberon>
Organization: private Linux site, southern Germany
Lines: 40

Pedro Roque Marques <roque@di.fc.ul.pt> wrote:
> them. The generator doesn't need to be very good, size and speed are
> major concerns. The reason why the phisical event counter based
> entropy is not too good for my purposes is that the generator will be
> called right after system initialization and the fact that the
> objective is obtaining equally distributed numbers.
> What is in question here is the right time to send packets to the
> network to avoid colisions.

For this purpose, a strong RNG (i.e. one with no visible correlation
between outputs) is not needed, so the classic "linear congruential"
s(0):=a; s(n+1):=b*s(n)+c; x(n):=s(n) mod d
for suitable values of a, b, c, d should suffice.
It is described in Knuth, Art of Computer Programming vol 2, in the
ANSI C standard and just about any text on elementary cryptography
(as a not-so-good example in the latter case :-)

What you need however (if I see that correctly) is basically one
random number, that specifies the (long - in the seconds range) delay
the manchine should spend at startup before it floods the network with
TFTP requests for its boot kernel, or similar. (I know certain OSs
have a very big problem with several diskless clients booting at
once...) Since you can't keep the state variable across boots, above
algorithm is not an option unless you use persistent memory for that
(i.e. reserve four bytes in the RTC chip for this variable and spend
an additional 10 lines to read/write them to the one-line PRNG
algorithm).

Using the RTC time for the random seed (the "a" variable above) isn't
probably a good idea either in case the RTCs actually are exact. ;-)
Using the ethernet address or some other non-universal constant
(hash sum on the BIOS ROM or whatever) as a random seed is easy but
means that on every boot, you get the same "random" numbers.

olaf

-- 
___        Olaf.Titz@inka.de or @{stud,informatik}.uni-karlsruhe.de       ____
__ o           <URL:http://www.inka.de/~bigred/>     <IRC:praetorius>
__/<_              >> Just as long as the wheels keep on turning round
_)>(_)______________ I will live for the groove 'til the sun goes down << ____