RFR(M): 8044186 Introduce a reproducible random generator
David Chase
david.r.chase at oracle.com
Mon Sep 22 14:29:06 UTC 2014
On 2014-09-22, at 10:09 AM, Sergei Kovalev <sergei.kovalev at oracle.com> wrote:
>
> On 20.09.2014 00:58, David Chase wrote:
>> I looked hard at Utils.java, that code looks fine.
>>
>> A question about BMITestRunner.java — I see
>> 76 int seed = Utils.getRandomInstance().nextInt();
>> …
>> 146 "-D" + Utils.SEED_PROPERTY_NAME + "=" + seed,
>>
>> But is it guaranteed that
>> (new Random(seed)).nextInt() == seed?
>> which is what I think this accomplishes?
>>
>> I just checked, it seems not to be true, so this is not correct re-run advice.
> Did you add -Dc.o.j.testlibrary.random.seed=<somevalue> to the command line?
>
> To verify please run below class:
>
> public class NewClass {
> static long seed = -1;
>
> public static void main(String[] args) {
> System.out.println(new Random(seed).nextInt());
> }
> }
>
> In my case it always printing out value: 1155099827
Right. If the seed is -1, nextInt is 1155099827.
And your program takes that value (1155099827) and
tells you to use it as a seed to reproduce the run.
If you do that, the next seed is 1155099827, not -1,
and the first call to nextInt will return 1494043703.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140922/15d7e6b4/signature-0001.asc>
More information about the hotspot-compiler-dev
mailing list