RFR(M): 8044186 Introduce a reproducible random generator
Sergei Kovalev
sergei.kovalev at oracle.com
Mon Sep 22 14:39:59 UTC 2014
I see.
I need to remove extra output from BMITestRunner.
88: System.out.println("Running test with seed: " + seed);
It adds some confusion.
Thanks.
On 22.09.2014 18:29, David Chase wrote:
> 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.
>
>
>
>
--
With best regards,
Sergei
More information about the hotspot-compiler-dev
mailing list