unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Andreas Rottmann <a.rottmann@gmx.at>
Cc: Guile Development <guile-devel@gnu.org>
Subject: Re: Random numbers (again) broken on 64-bit platforms
Date: Tue, 27 Jul 2010 10:52:56 +0200	[thread overview]
Message-ID: <m3eiepi9w7.fsf@unquote.localdomain> (raw)
In-Reply-To: <87vd82554r.fsf@delenn.lan> (Andreas Rottmann's message of "Mon,  26 Jul 2010 23:01:56 +0200")

Heya,

On Mon 26 Jul 2010 23:01, Andreas Rottmann <a.rottmann@gmx.at> 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/



  reply	other threads:[~2010-07-27  8:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 21:01 Random numbers (again) broken on 64-bit platforms Andreas Rottmann
2010-07-27  8:52 ` Andy Wingo [this message]
2010-08-01 18:44   ` Andreas Rottmann
2010-08-01 19:57     ` Andy Wingo
2010-08-01 22:06       ` No Itisnt
2010-08-02  7:11         ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3eiepi9w7.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=a.rottmann@gmx.at \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).