From mboxrd@z Thu Jan 1 00:00:00 1970 From: wkt@minnie.tuhs.org (Warren Toomey) Date: Thu, 20 Feb 2003 07:09:19 +1000 (EST) Subject: [TUHS] random(3) definition In-Reply-To: <20030219203609.GA85462@gsmx07.alcatel.com.au> from Peter Jeremy at "Feb 20, 2003 07:36:09 am" Message-ID: <200302192109.h1JL9JU91269@minnie.tuhs.org> 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 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. Warren