I think I forgot to reply to the list, also.<br><br>---------- Forwarded message ----------<br><span class="gmail_quote">From: <b class="gmail_sendername">Doug Williams</b> <<a href="mailto:firstname.lastname@example.org">
email@example.com</a>><br>Date: Aug 15, 2007 6:47 AM<br>Subject: Re: [plt-scheme] Error in SRFI 27<br>To: Matthew Flatt <<a href="mailto:firstname.lastname@example.org">email@example.com</a>><br><br></span>In the science collection I wrappered SRFI 27 for random number generation, provided contracts for the calls, and a added accessors that gave a more PLT Scheme look-and-feel. But, I used SRFI 27 for portability - primarily so other Scheme code could be ported in more easily. As for speed, faster is better, but it isn't everything. The main characteristics I need from SRFI 27 is that it is repeatable - I will get the same sequence of random numbers by default, but I can randomize the stream when needed. Both modes are important for my simulations.
<br>I'm not sure if you are meaning that the implementation would speed up or if it would slow down if you backported your changes. But, if SRFI used the native PLT Scheme random source (or vice versa) [and kept the characteristics I mentioned above], it might simplify my wrapper to just the contracts.
<br><span class="sg"><br>Doug</span><div><span class="e" id="q_1146990a338ff39f_2"><br><br><div><span class="gmail_quote">On 8/15/07, <b class="gmail_sendername">Matthew Flatt</b> <<a href="mailto:firstname.lastname@example.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Does the speed of this random-number generator matter for your<br>purposes?<br><br>Long ago, I changed MzScheme's `random' to use the same algorithm, and<br>I set things up so that MzScheme's `random' could be used to implement
<br>SRFI-27. But I never went back to change the SRFI-27 implementation.<br><br>Matthew<br><br>At Tue, 14 Aug 2007 21:08:44 -0600, "Doug Williams" wrote:<br>> There seems to have been an error introduced into SRFI 27 sometime late in
<br>> the V370 development leading up to V371. The random reals generated by SRFI<br>> 27 all seem to be negative numbers in the range on -1.0e-8 to<br>> -1.0e-10instead of 0 to 1. The following code shows the problem. In
<br>> V370 it works<br>> properly giving numbers in the range 0.0 to 1.0. When run under V370.7 or<br>> V371, it gives the bad numbers.<br>><br>> (require (lib "27.ss" "srfi"))<br>>
> (let* ((r (make-random-source))<br>> (rand (random-source-make-reals r)))<br>> (do ((i 0 (+ i 1)))<br>> ((= i 100) (void))<br>> (printf "random real = ~a~n"<br>> (rand))))
<br>><br>> Doug<br>> _________________________________________________<br>> For list-related administrative tasks:<br>> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">