You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Rostislav Krasny (JIRA)" <ji...@apache.org> on 2015/12/21 02:42:46 UTC

[jira] [Comment Edited] (MATH-1304) "nextBytes" methods in RNG implementations

    [ https://issues.apache.org/jira/browse/MATH-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15065979#comment-15065979 ] 

Rostislav Krasny edited comment on MATH-1304 at 12/21/15 1:42 AM:
------------------------------------------------------------------

One note about making the code of {{nextBytes()}} reusable. When I thought about that {{BitsStreamGenerator}} could extend {{AbstractRandomGenerator}} I realized it can introduce a compatibility issue. If one uses {{instanceof}} to distinguish between classes inherited from current {{BitsStreamGenerator}} and {{AbstractRandomGenerator}} his/her code may stop doing it correctly after such change. So if you decide to have only one code of nextBytes() used by both {{BitsStreamGenerator}} and {{AbstractRandomGenerator}} you need to do it in a new super class of them.

But this is just a note. I'm fine with your decision to just copy it between those two classes. I'm not fine with the code itself, but this is another story :-)


was (Author: rosti.bsd):
One note about making the code of {{nextBytes()}} reusable. When I thought about that {{BitsStreamGenerator}} could extend {{AbstractRandomGenerator}} I realized it can introduce a compatibility issue. If one uses {{instanceof}} to distinguish between classes inherited from current {{BitsStreamGenerator}} and {{AbstractRandomGenerator}} his/her code may stop doing it correctly after such change. So if you decide to have only one code nextBytes() used by both {{BitsStreamGenerator}} and {{AbstractRandomGenerator}} you need to do it in a new super class of them.

But this is just a note. I'm fine with your decision to just copy it between those two classes. I'm not fine with the code itself, but this is another story :-)

> "nextBytes" methods in RNG implementations
> ------------------------------------------
>
>                 Key: MATH-1304
>                 URL: https://issues.apache.org/jira/browse/MATH-1304
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.5
>            Reporter: Gilles
>            Assignee: Gilles
>             Fix For: 4.0
>
>
> There are two implementations of the "nextBytes" method.
> One is in {{AbstractRandomGenerator}} and the other in {{BitsStreamGenerator}}.
> The code should be the same.
> And, if possible, it should be shared.
> MATH-1300 has several suggestions for improving the current implementations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)