[TUHS] random(3) definition

Warren Toomey wkt at minnie.tuhs.org
Thu Feb 20 07:09:19 AEST 2003

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>


More information about the TUHS mailing list