Aubrey Jaffer scripsit:

> One of the important attributes of a seedable pseudo-random number
> generator is that it allows a computation to be repeated by starting
> with the same seed.  A program containing:
> 
>   (expt (random 42) (random 42))
> 
> will not be portable between R5RS or R6RS implementations because the
> order of evaluation is unspecified.  

That's true, but it's a gross understatement.  If you write:

(define s (make-random-state))
(let loop ()
  (reset-random-state! 3141592653)
  (display (expt (random 42) (random 42)))
  (newline)
  (loop))

this code need not print the same number every time through the loop!
It's permissible to use a different order of argument evaluation on
*every evaluation* of the same procedure call.

-- 
John Cowan  [email protected]  http://ccil.org/~cowan
Any sufficiently-complicated C or Fortran program contains an ad-hoc,
informally-specified bug-ridden slow implementation of half of Common Lisp.
        --Greenspun's Tenth Rule of Programming (rules 1-9 are unknown)

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to