The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] random(3) definition
@ 2003-02-19 20:36 Peter Jeremy
  2003-02-19 21:09 ` Warren Toomey
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Jeremy @ 2003-02-19 20:36 UTC (permalink / raw)


Does anyone here know why the BSD random(3) is defined to return a
positive int (31 bits) rather than a full 32 bits of pseudo-entropy?
(This came up is a discussion comparing random(3) with arc4random(3)
in another list).

Peter




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [TUHS] random(3) definition
  2003-02-19 20:36 [TUHS] random(3) definition Peter Jeremy
@ 2003-02-19 21:09 ` Warren Toomey
  0 siblings, 0 replies; 2+ messages in thread
From: Warren Toomey @ 2003-02-19 21:09 UTC (permalink / raw)


In article by Peter Jeremy:
> Does anyone here know why the BSD random(3) is defined to return a
> positive int (31 bits) rather than a full 32 bits of pseudo-entropy?
> (This came up is a discussion comparing random(3) with arc4random(3)
> in another list).
> Peter

<wild guess>
Maybe it's a C-ism. With a 31-bit shift register, the overflow is going
to stay in a 32-bit variable where it can be dealt with in C. If they
had used a 32-bit shift register, then grabbing the overflow becomes
more difficult.
</wild guess>

	Warren



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-19 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 20:36 [TUHS] random(3) definition Peter Jeremy
2003-02-19 21:09 ` Warren Toomey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).