[CM] CM random seed

Joshua Parmenter joshp@u.washington.edu
Sat, 21 May 2005 12:38:58 -0700


--Apple-Mail-5-958184693
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

Thanks Rick.

I was starting to get to that understanding myself as I've been  
working on it this morning. A few minutes ago I realized that there  
were different openmcl versions used in the os x binary dists. I  
think CM 2.4 was using 0.14.1, and now it looks like 0.14.3 is being  
used... sorry for the trouble... Thanks for you help!

Josh


******************************************
Joshua D. Parmenter
http://homepage.mac.com/joshpar/

"...Some people think a composer's supposed to please them, but in a  
way a composer is a chronicler... He's supposed to report on what  
he's seen and lived."
                                                                         
      -Charles Mingus

On May 21, 2005, at 12:27 PM, Rick Taube wrote:

> On May 21, 2005, at 11:23 AM, Joshua Parmenter wrote:
>
>
>> Thanks Rick, that works.
>> But how can I change the seeded value?  Or save one (other then  
>> the one generated by nil) for later use (possibly in another  
>> session) if the printed one can't be manipulated? I know this will  
>> be different for different lisps, but I am more concerned with  
>> personal use, and I was able to do this not long ago (in CM 2.4).  
>> Now that code is broken, and I want to try and find a way to fix it.
>> Josh
>>
>
> CL deliberately  does not provide a way to seed random states.  but  
> most implemenations probably have some mechanism -- in openmcl its  
> ccl::initialize-random-state. this is what ccl does in l1- 
> numbers.lisp :
>
> (defparameter *random-state* (initialize-random-state #xFBF1 9))
>
> as far as saving random-states go, you should be able to print them  
> to a file and read them back in. Most Lisps print random states  
> using the #S read macro for just this reason -- i dont know why ccl  
> uses #. since random-state cannot be a function.
>
> I guess you could redefine the print-object method  for random  
> states to print like this:
>
>     #.(ccl::initialize-random-state nnn nnn)
>
> anyway cm has nothing to do with this stuff, its up to the  
> underlying lisp to provide something (or not). if it worked in cm  
> 2.4 then it was probably only because ccl was letting you do  
> something that it no longer allows.
>
>


--Apple-Mail-5-958184693
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; ">Thanks Rick.<DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>I was starting to get to =
that understanding myself as I've been working on it this morning. A few =
minutes ago I realized that there were different openmcl versions used =
in the os x binary dists. I think CM 2.4 was using 0.14.1, and now it =
looks like 0.14.3 is being used... sorry for the trouble... Thanks for =
you help!</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Josh</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR><DIV> <P style=3D"margin:=
 0.0px 0.0px 0.0px 0.0px"><FONT face=3D"Helvetica" size=3D"3" =
style=3D"font: 12.0px =
Helvetica">******************************************</FONT></P> <P =
style=3D"margin: 0.0px 0.0px 0.0px 0.0px"><FONT face=3D"Helvetica" =
size=3D"3" style=3D"font: 12.0px Helvetica">Joshua D. =
Parmenter</FONT></P> <P style=3D"margin: 0.0px 0.0px 0.0px 0.0px"><FONT =
face=3D"Helvetica" size=3D"3" style=3D"font: 12.0px Helvetica"><A =
href=3D"http://homepage.mac.com/joshpar/">http://homepage.mac.com/joshpar/=
</A></FONT></P> <P style=3D"margin: 0.0px 0.0px 0.0px 0.0px; font: =
12.0px Helvetica; min-height: 14.0px"><BR></P> <P style=3D"margin: 0.0px =
0.0px 0.0px 0.0px"><FONT face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">"...Some people think a composer's supposed to please =
them, but in a way a composer is a chronicler... He's supposed to report =
on what he's seen and lived."</FONT></P> <P style=3D"margin: 0.0px 0.0px =
0.0px 0.0px"><FONT face=3D"Helvetica" size=3D"3" style=3D"font: 12.0px =
Helvetica"><SPAN class=3D"Apple-converted-space">=A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 <SPAN class=3D"Apple-converted-tab">=A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 </SPAN></SPAN>-Charles Mingus</FONT></P>  =
</DIV><BR><DIV><DIV>On May 21, 2005, at 12:27 PM, Rick Taube =
wrote:</DIV><BR class=3D"Apple-interchange-newline"><BLOCKQUOTE =
type=3D"cite"><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">On May 21, 2005, at 11:23 AM, =
Joshua Parmenter wrote:</DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: =
14px; "><BR></DIV> <BR><BLOCKQUOTE type=3D"cite"><DIV style=3D"margin-top:=
 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks =
Rick, that works.=A0</DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; ">But how can I change the =
seeded value?=A0 Or save one (other then the one generated by nil) for =
later use (possibly in another session) if the printed one can't be =
manipulated? I know this will be different for different lisps, but I am =
more concerned with personal use, and I was able to do this not long ago =
(in CM 2.4). Now that code is broken, and I want to try and find a way =
to fix it.</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">Josh</DIV> <BR></BLOCKQUOTE><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">CL =
deliberately<SPAN class=3D"Apple-converted-space">=A0 </SPAN>does not =
provide a way to seed random states.<SPAN =
class=3D"Apple-converted-space">=A0 </SPAN>but most implemenations =
probably have some mechanism -- in openmcl its =
ccl::initialize-random-state. this is what ccl does in l1-numbers.lisp =
:</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: =
0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">(defparameter *random-state* =
(initialize-random-state #xFBF1 9))</DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: =
14px; "><BR></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">as far as saving random-states =
go, you should be able to print them to a file and read them back in. =
Most Lisps print random states using the #S read macro for just this =
reason -- i dont know why ccl uses #. since random-state cannot be a =
function.</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">I guess you could redefine the print-object =
method<SPAN class=3D"Apple-converted-space">=A0 </SPAN>for random states =
to print like this:</DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; =
"><BR></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; "><SPAN =
class=3D"Apple-converted-space"><SPAN class=3D"Apple-converted-tab">=A0 =
=A0 </SPAN></SPAN>#.(ccl::initialize-random-state nnn nnn)</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">anyway =
cm has nothing to do with this stuff, its up to the underlying lisp to =
provide something (or not). if it worked in cm 2.4 then it was probably =
only because ccl was letting you do something that it no longer =
allows.</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> <BR =
class=3D"Apple-interchange-newline"></BLOCKQUOTE></DIV><BR></DIV></BODY></=
HTML>=

--Apple-Mail-5-958184693--