[plt-scheme] Does SRFI-27 specify repeatable PRNGs?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jan 2 13:09:31 EST 2008

Some clarifications on random numbers generated by different PLT Scheme

At Wed, 2 Jan 2008 10:54:13 -0700, "Doug Williams" wrote:
> Actually, SRFI 27 specifies repeatable random sources.  You have to call
> random-source-randomize! to get different ones.  And, there is a
> random-source-pseudo-randomize! procedure that gives you multiple,
> independent, repeatable random sources.  There are also routines in the
> science collection to create vectors of independent random sources.

But see below regarding v372 versus other versions.

At Wed, 02 Jan 2008 10:21:14 -0700, Chongkai Zhu wrote:
> > How about the built-in generator of MzScheme, might it change in 
> > future or is it part of the specs that it won't change under the hood?
> >
> Matthew just changed the built-in generator of MzScheme, as a result of 
> a discussion here a few days ago. 

But the changes only extend `random' to work with arguments that it
didn't accept before. For results that would have been generated
before, the result is still the same. We expect for no further changes.

> The SRFI 27 implementation in SVN 
> (v399) is build on top of the built-in generator, and produces the same 
> sequence as the reference implementation of SRFI 27.

To elaborate just a little:

SRFI-27 in v371 and earlier and v3.99.x produce exactly the same
result, and they are the same as the SRFI-27 reference implementation.

[I committed a repair to v3.99.x in SVN just now to put a new random
 source in the same initial state as v371 and earlier. Otherwise, the
 above wouldn't be true.]

SRFI-27 in v372 produces different results, because the seeding
function is different, and because a different initial state is used
for a random source.


Posted on the users mailing list.