From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: Random numbers (again) broken on 64-bit platforms Date: Tue, 27 Jul 2010 10:52:56 +0200 Message-ID: References: <87vd82554r.fsf@delenn.lan> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1280220624 16731 80.91.229.12 (27 Jul 2010 08:50:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Jul 2010 08:50:24 +0000 (UTC) Cc: Guile Development To: Andreas Rottmann Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jul 27 10:50:23 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Odfrd-0000ed-Nq for guile-devel@m.gmane.org; Tue, 27 Jul 2010 10:50:18 +0200 Original-Received: from localhost ([127.0.0.1]:44815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Odfrd-0001SW-11 for guile-devel@m.gmane.org; Tue, 27 Jul 2010 04:50:17 -0400 Original-Received: from [140.186.70.92] (port=39335 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdfrV-0001Ph-IN for guile-devel@gnu.org; Tue, 27 Jul 2010 04:50:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdfrS-0005V6-SK for guile-devel@gnu.org; Tue, 27 Jul 2010 04:50:09 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:64701 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdfrS-0005Uu-Os for guile-devel@gnu.org; Tue, 27 Jul 2010 04:50:06 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 11796C86D5; Tue, 27 Jul 2010 04:50:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=yZAmBU1iU1Hn6XBYJxHjUDU+gaY=; b=AJLS5H 0wD/8wqyi9VXXLZZYqqoQghhjRFsj4vx4JlV1zsp9ejqtzwqJcgZPm1ByYdGPtQ9 tA99x4qXJmKXQBGs9TX2pFG0apfEJeVtO+BA9nEht7ZJSroQfkwaYIC5QoMn3fqC JFQN6OwVuVKqoDKBT8hztflrx+RmxUsy72qk0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=gIstZ/CbOFh3QIWTFy123ZXfieTlBSKa 3chzlGHunysAdyo5P2B+rTnT3qWD4JXMaytKPHLxzc6M//H0FBBDU/pCnlp8+SGy ugeKr8IEm+V7JjR3PqIy8LgpOr6kdExMkcEVq5tNXDYLWW219zjAm02+mlM9fLN4 B0lbS3+hSZ8= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id EC650C86D4; Tue, 27 Jul 2010 04:50:04 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [83.81.248.55]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 87443C86D3; Tue, 27 Jul 2010 04:50:03 -0400 (EDT) In-Reply-To: <87vd82554r.fsf@delenn.lan> (Andreas Rottmann's message of "Mon, 26 Jul 2010 23:01:56 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: F36BD4E6-995B-11DF-9083-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10738 Archived-At: Heya, On Mon 26 Jul 2010 23:01, Andreas Rottmann writes: > scheme@(guile-user)> (random (ash 1 32)) > ERROR: In procedure random: > ERROR: Argument 1 out of range: 4294967296 Well, it's not a segfault at least :) The point of that change was to indicate that the RNG did not return sizeof(unsigned long) bits of randomness; it always returned 32 bits. See the note in "BSD Random Number Functions" in libc's manual: *NB:* Temporarily this function was defined to return a `int32_t' value to indicate that the return value always contains 32 bits even if `long int' is wider. The standard demands it differently. Users must always be aware of the 32-bit limitation, though. I'll fix this now to avoid the error, but there is still work to do on the RNG -- we really need to update the RNG, I think. Brian Gough, the GSL maintainer, says MT19937 is the one to use, and specifically the new SIMD version at http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html. We should replace our MWC RNG with that one. Would you be interested in doing this? We would need some test suites too, I think, and possibly changes to the scm_t_rng structure. Cheers, Andy -- http://wingolog.org/