commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rostislav Krasny (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (MATH-1304) "nextBytes" methods in RNG implementations
Date Mon, 21 Dec 2015 01:42:46 GMT

    [ 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)

Mime
View raw message