[Cuis-dev] Random fixes

Hernan Wilkinson hernan.wilkinson at 10pines.com
Fri Jun 7 05:40:36 PDT 2019

Thank you!
Integrated and in github.


On Fri, Jun 7, 2019 at 12:42 AM Luciano Notarfrancesco <luchiano at gmail.com>

> Hi Hernan,
> Yes, I think testSeed0 should be removed. It is better to make
> Random>>seed: accept any Integer as argument, and the seed must competently
> determine the generator output.
> Accepting any Integer argument is desirable because we can use Random
> without making assumptions of its internals, and I think initializing a
> random number generator with an arbitrary integer is reasonable and
> general. Completely determining the generator output is important also for
> repeatability of tests and experiments, we want to make sure that
> initializing two generators of the same class with the same seed will
> produce the same outputs.
> Here are 7 new tests and a new version of the fixes for Random. I removed
> testSeed0 too. This version fixes another two issues, and they are tested
> for correctness now. Let me know what you think.
> On Thu, Jun 6, 2019 at 6:55 PM Hernan Wilkinson <
> hernan.wilkinson at 10pines.com> wrote:
>> Hi Luciano,
>>  there are three tests that fail when running the RandomTest of the
>> BaseImageTests.pck.st
>>  In reality, it is the same test, testSeed0 for the different Random
>> implementations, that expects to fail when the seed is 0 and it does not.
>>  I'm not an expert on the matter so I'm not sure the test is correct or
>> wrong. I presume you change allow a seed to be 0, something not allowed
>> before, but could you take a look at it and fix what it is necessary (the
>> test or your change).
>>  Let me know and I'll integrate it after.
>> Thanks!
>> Hernan.
>> On Thu, Jun 6, 2019 at 2:51 AM Luciano Notarfrancesco via Cuis-dev <
>> cuis-dev at lists.cuis.st> wrote:
>>> This changeset fixes an infinite loop when doing:
>>>   Random new nextInteger: 0
>>> It also allows to use any integer as seed to initialize a new Random, so
>>> you can do something like:
>>>   Random seed: 12938479182374979182734987
>>> without making assumptions about the particular implementation of Random
>>> that will be created. The new ParkMiller88Random will be initialized
>>> exactly as before if the seed is in the originally expected range (keeping
>>> backwards compatibility); but if the seed is not in that range, now it will
>>> initialize the generator with a valid seed derived from the user-provided
>>> seed, instead of raising an exception.
>>> The changeset also adds a method Random>>nextBoolean that returns true
>>> or false.
>>> --
>>> Cuis-dev mailing list
>>> Cuis-dev at lists.cuis.st
>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>> --
>> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
>> *Phone: +54-011*-4893-2057
>> *Twitter: @HernanWilkinson*
>> *site: http://www.10Pines.com <http://www.10pines.com/>*
>> Address: Alem 896, Floor 6, Buenos Aires, Argentina


*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190607/392d0d85/attachment-0001.html>

More information about the Cuis-dev mailing list