commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-963) Interface "RandomGenerator" is missing "nextLong(long)" method
Date Fri, 05 Apr 2013 10:20:15 GMT


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.
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

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:
>             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:

View raw message