From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Improve `seed->random-state' in stable-2.0? Date: Thu, 19 Jan 2012 22:28:13 -0500 Message-ID: <87d3afvyr6.fsf@netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1327030153 15861 80.91.229.12 (20 Jan 2012 03:29:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2012 03:29:13 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jan 20 04:29:08 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ro5A3-0006Pi-SR for guile-devel@m.gmane.org; Fri, 20 Jan 2012 04:29:08 +0100 Original-Received: from localhost ([::1]:41630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro5A3-00083V-Fc for guile-devel@m.gmane.org; Thu, 19 Jan 2012 22:29:07 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:48881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro5A0-00082p-A7 for guile-devel@gnu.org; Thu, 19 Jan 2012 22:29:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ro59z-0002Wi-5S for guile-devel@gnu.org; Thu, 19 Jan 2012 22:29:04 -0500 Original-Received: from world.peace.net ([96.39.62.75]:53845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro59z-0002WU-1X for guile-devel@gnu.org; Thu, 19 Jan 2012 22:29:03 -0500 Original-Received: from c-98-216-245-176.hsd1.ma.comcast.net ([98.216.245.176] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1Ro59t-0005q9-BL; Thu, 19 Jan 2012 22:28:57 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:13592 Archived-At: Hello all, `seed->random-state' is poorly implemented when passed a numeric argument. It converts the number to a decimal string, and then `scm_i_init_rstate' takes over and basically adds every 8th byte together to form the 64-bit internal state. The problem is that only about 3-bits of entropy is present in each character of the string, and then these are added together in an aligned fashion, which also loses a great deal of entropy. I haven't analyzed this carefully, but I'd be surprised if we preserve much more than 32-bits of entropy from the original seed. I know how to make this _much_ better, but here's the question: is it okay to change the behavior of the random number generator in 2.0? Or is it important that the same sequence of random numbers are generated from a given seed in the entire stable-2.0 series? Mark