commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [jira] [Commented] (MATH-963) Interface "RandomGenerator" is missing "nextLong(long)" method
Date Fri, 05 Apr 2013 17:02:22 GMT
This discussion should be on the mailing list.

On 4/5/13 3:20 AM, Gilles (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/MATH-963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13623503#comment-13623503
] 
>
> Gilles commented on MATH-963:
> -----------------------------
>
> bq. [...] you can use a RandomAdaptor. That is really what led to tearing off the interface
from Random.
>
> If, as it looks like, "RandomAdaptor" is a bridge from "RandomGenerator" to "j.u.Random",
it does not need to implement the "RandomGenerator" API.

Look at what the adaptor does.  It wraps a RandomGenerator.  It
makes it possible to make the underlying PRNG pluggable in apps that
use j.u.Random.
> This is what a bridge is for: change from one API to another. Hence, it is also not necessary
to mimic the target API.
>
> If "RandomGenerator" were an abstract class, you'd be able to use it in the same way
with "RandomAdaptor".
>
> It seems that the purpose of "RandomAdaptor" being also a "RandomGenerator" is for the
_same_ object reference to be passed both to code that expects a "j.u.Random" and to code
that expects a "RandomGenerator".
> I find it better to not mix the two types in this way.
>
>                 
>> Interface "RandomGenerator" is missing "nextLong(long)" method
>> --------------------------------------------------------------
>>
>>                 Key: MATH-963
>>                 URL: https://issues.apache.org/jira/browse/MATH-963
>>             Project: Commons Math
>>          Issue Type: Bug
>>    Affects Versions: 3.2
>>            Reporter: Gilles
>>            Priority: Trivial
>>              Labels: api-change
>>
>> There is a method "nextInt(int)" but not "nextLong(long)".
>> The "BitsStreamGenerator" class already implements it.
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message