From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.devel Subject: Re: Nearly finished (re)integrating GMP for bignums. Date: Wed, 12 Feb 2003 18:34:59 +0100 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <87heb9pjni.fsf@raven.i.defaultvalue.org> <87r8adihxe.fsf@zagadka.ping.de> Reply-To: djurfeldt@nada.kth.se NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1045071812 29373 80.91.224.249 (12 Feb 2003 17:43:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 12 Feb 2003 17:43:32 +0000 (UTC) Cc: Rob Browning Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18j0mY-0006wd-00 for ; Wed, 12 Feb 2003 18:34:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18j0nk-0008Ut-05 for guile-devel@m.gmane.org; Wed, 12 Feb 2003 12:36:04 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18j0mz-00086u-00 for guile-devel@gnu.org; Wed, 12 Feb 2003 12:35:17 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18j0mr-000802-00 for guile-devel@gnu.org; Wed, 12 Feb 2003 12:35:12 -0500 Original-Received: from kvast.blakulla.net ([213.212.20.77]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18j0mq-0007xG-00 for guile-devel@gnu.org; Wed, 12 Feb 2003 12:35:08 -0500 Original-Received: from barbara.blakulla.net ([213.212.21.238] helo=linnaeus) by kvast.blakulla.net with esmtp (Exim 3.36 #1 (Debian)) id 18j0mj-0007HH-00; Wed, 12 Feb 2003 18:35:01 +0100 Original-Received: from mdj by linnaeus with local (Exim 3.36 #1 (Debian)) id 18j0mi-0000LO-00; Wed, 12 Feb 2003 18:35:00 +0100 Original-To: Marius Vollmer In-Reply-To: <87r8adihxe.fsf@zagadka.ping.de> (Marius Vollmer's message of "12 Feb 2003 17:26:37 +0100") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) Original-cc: guile-devel@gnu.org Original-cc: djurfeldt@nada.kth.se X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:1916 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1916 Marius Vollmer writes: >> With respect to random.c, we have a pluggable random number system, >> and ATM the bignum randoms are computed using the >> "get_32_random_bits()" function provided by the random state object. >> However GMP has its own random number generators, including ones for >> bignums. Any thoughts on how we should handle this? > > I think we should use the GMP generators unless they are not as good > as ours. But I doubt that. This is actually a little tricky. I'd like to bring up two points about this issue: 1. Marius, do you suggest to use the GMP generators as a source of random bits for random.c, that is to "plug in" the GMP generator as a replacement for scm_i_uniform32? That would be OK, but using scm_i_uniform32 "in parallel" with the GMP generators would probably not be. It is a dangerous mistake to use multiple pseudo-random generators within the same application, the reason being that while each generator on its own will have an extremely long cycle in its number series, interference between the series can give deterministic behavior. For example, the difference between the outputs of two generators might have a short cycle. Interference can occur in any number of strange ways if two generators simultaneously affect the same program. 2. What do you mean by a "good" RNG? I'd say it is good if it is fast. Our generator is fast. Can you name any single other criterion which is not "religious" and which our generator doesn't fulfil? (I'm talking about something measurable here.) I'm no expert in RNG:s, but when doing research before writing random.c I couldn't find any arguments against using the current MWC generator. As stated in a commentary in random.c, it has a cycle length of 4.6e18 and passes all tests in the "DIEHARD" RNG test suite. At any rate, it should be sufficient for standard Guile use. (For those doubting the utility of speed in a RNG, I can only note that for me it's very important. In my simulation software I often generate large random matrices and need to have multiple sources of simulated "noise".) Ideally, the bignum code would use the pluggable source of random bits in random.c and the GMP generators would be provided as optional plugins for random.c. Rob, is this possible? Mikael _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel