<html><body bgcolor="#FFFFFF"><div>Doh! Yes, Java is missing a getSeed() here. Then I would verify that the java.ip.Serialazable contract does what one would expect, and use that. For a possible optimization, one might use some variant of SecureRandom here, which presumably has greater entropy.<br><br>Tersely written <span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">from my iPhone</span></div><div><br>On 15.07.2011, at 21:45, Erik Huelsmann <<a href="mailto:ehuels@gmail.com">ehuels@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>Hi Mark,<br><br><div class="gmail_quote">On Fri, Jul 15, 2011 at 9:41 PM, Mark Evenson <span dir="ltr"><<a href="mailto:evenson@panix.com"><a href="mailto:evenson@panix.com">evenson@panix.com</a></a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I think all you need to serialize is a structure that contains the long seed for java.until.Random.  Or am I missing something?<br>
<br></blockquote><div><br></div><div>Well, the problem I'm having with that approach is that I don't seem to have any means to extract the seed from the Random object: it has a method setSeed(), but not a getSeed(). Do you have any idea how?</div>
<div><br></div><div><br></div><div>Bye,</div><div><br></div><div><br></div><div>Erik.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Sent from my iPad<br>
<div><div></div><div class="h5"><br>
On Jul 15, 2011, at 6:59 PM, Erik Huelsmann <<a href="mailto:ehuels@gmail.com"><a href="mailto:ehuels@gmail.com">ehuels@gmail.com</a></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 The problem shown by the test is that our RANDOM-STATEs are not printable. From the perspective of ABCL, that's logical: Java's Random objects are serializable, but as everywhere in Java, it's serialization is internal to the implementation. The Random object is initialized using a 'seed' long value, but there's no way to extract a 'seed' value from the object to be used 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 some sort of printed representation (sure, we'll definitely need to look into ways to load)<br>
><br>
> The advantage of (1) is that we can create it all in Lisp, however, it's  pure additional code, since we won't be leveraging what's already there.<br>
><br>
> The advantage of (2) is that we can use what Java maintains for us and even better: we can use the random number generator shared between Lisp and Java code. I imagine the disadvantage of this solution is that the serialization of the random state can differ between Java versions and implementations.<br>

><br>
> Any ideas??<br>
><br>
><br>
> Bye,<br>
><br>
><br>
> Erik.<br>
</div></div>> _______________________________________________<br>
> armedbear-devel mailing list<br>
> <a href="mailto:armedbear-devel@common-lisp.net"><a href="mailto:armedbear-devel@common-lisp.net">armedbear-devel@common-lisp.net</a></a><br>
> <a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel" target="_blank"><a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel</a></a><br>
</blockquote></div><br>
</div></blockquote></body></html>