On Mon, Sep 26, 2016 at 11:36 PM, Gilles <gil...@harfang.homelinux.org>
wrote:

> On Mon, 26 Sep 2016 21:23:24 -0500, Brent Worden wrote:
>
>>
>> With that said, I started thinking a bridge to go between the two engines,
>> UniformRandomProvider and java.util.Random, might be beneficial.  For
>> third
>> parties that have implemented java.util.Random subclasses, it would be
>> nice
>> to provide the means to easily adapt their Random implementation to a
>> UniformRandomProvider so it can be used in commons-rng related code.
>>
>
> Like method "asUniformRandomProvider" in "o.a.c.math4.random.RandomUtils"
> ("master" branch)?
>
>
Yes, that is exactly what I was thinking.



> Conversely, for third parties that use java.util.Random instances, it would
>> be nice to easily adapt a UniformRandomProvider to a Random so the
>> commons-rng generators could be used.
>>
>
> That would be possible (but the bridge must be from "RandomSource",
> not "UniformRandomProvider"): see class "o.a.c.math4.random.RngAdaptor".
>
> Gilles
>
>
Why RandomSource?  I was thinking a reciprocal method to the above:

public static Random asRandom(UnifiedRandomProvider urp) {
    return new Random() {
        @Override
        protected int next(int bits) {
            ...
        }
    };
}


Brent

Reply via email to