Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Feb 2003 22:19:33 +0000
From:      Mark Murray <mark@grondar.org>
To:        "Andrey A. Chernov" <ache@nagual.pp.ru>
Cc:        current@FreeBSD.ORG
Subject:   Re: rand() is broken 
Message-ID:  <200302022219.h12MJYaX052408@grimreaper.grondar.org>
In-Reply-To: Your message of "Mon, 03 Feb 2003 01:01:28 %2B0300." <20030202220128.GC68356@nagual.pp.ru> 

next in thread | previous in thread | raw e-mail | index | archive | help
"Andrey A. Chernov" writes:
> On Sun, Feb 02, 2003 at 21:23:43 +0000, Mark Murray wrote:
> > 
> > That was random(9). KERNEL random().
> 
> KERNEL random() can be easily implemented (better - replaced) with
> arc4random(), there is no objections. But...
> 
> 1) Implementing random(3) with RC4 is not needed, its algorithm is 
> already equal or better.

Rubbish. :-) RC4's internal state is 256 bytes. In theory, its
cycle-of-repetition is 2^(8*256) bits.

The current library PRNGs are quite a bit less than that.

> 2) Implementing rand(3) with RC4 can be possible only if seed (i.e. 
> state) can be stored in single word (due to rand_r()) restrictions.

This is true. Sort of. But in this case, things get less easy.

Hmm. I need to look at this some more.

Thanks!

M

M
--
Mark Murray
iumop ap!sdn w,I idlaH

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?200302022219.h12MJYaX052408>