Hi Theam,<br><br><div class="gmail_quote">On Sat, Jul 16, 2011 at 3:58 AM, Theam Yong Chew <span dir="ltr"><<a href="mailto:senatorzergling@gmail.com">senatorzergling@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 16-Jul-2011 5:00 AM, "Erik Huelsmann" <<a href="mailto:ehuels@gmail.com">ehuels@gmail.com</a>> wrote:<br>
><br>
><br>
> Today I was looking at fixing some of our PRINT.* failures in the ansi test suite.<br>
><br>
> Hoping to get an easy start, I started looking PRINT.RANDOM-STATE.1<br>
<br>
</div>...<br>
<div class="im"><br>
> there's no way to extract a 'seed' value from the object to be used<br>
> to initialize an object into the same state.<br>
><br>
> So, I'm now pondering what action to take. I'm seeing several options:<br>
><br>
> 1. build our own pseudo random number generator with its own random state<br>
> 2. serialize the Random object to a byte array and use that array as<br>
> some sort of printed representation (sure, we'll definitely need to<br>
> look into ways to load)<br>
><br>
> The advantage of (1) is that we can create it all in Lisp, however,<br>
> it's pure additional code, since we won't be leveraging what's<br>
> already there.<br>
<br>
</div>You are talking about leveraging Java, but what about leveraging Lisp?<br></blockquote><div><br></div><div>Sure. When we have to code things ourselves, I prefer Lisp too. However, in case the Java libraries provide required functionality and we can implement simple wrappers, we can benefit from the maintenance effort that's being put into Java without spending any effort ourselves: fixes to java will automatically propagate to our lisp.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I'm not sure about speed, but this is often cited on the<br>
web/newsgroups,<br>
<br>
<a href="http://www.ccs.neu.edu/home/dorai/notes/mrg32k3a.lisp" target="_blank">http://www.ccs.neu.edu/home/dorai/notes/mrg32k3a.lisp</a><br>
<br>
and there're the ones from SBCL too.<br>
<div class="im"><br>
> The advantage of (2) is that we can use what Java maintains for us<br>
> and even better: we can use the random number generator shared<br>
> between Lisp and Java code. I imagine the disadvantage of this<br>
> solution is that the serialization of the random state can differ<br>
> between Java versions and implementations.<br>
<br>
</div>I would tend to favour Lisp solutions, but yeah...<font color="#888888"><br>
</font></blockquote></div><br><div>It looks - also given Mark's reaction - like we may need to implement this in Lisp to achieve the behaviour we need: readable random states. Possibly, we can also offer a (non-printable) wrapper around the java Random object...</div>
<div><br></div><div>Thanks for your feedback! I'll save the link to see if that solution or the algorithms in SBCL can help us out here.</div><div><br></div><div>Bye,</div><div><br></div><div>Erik.</div>