You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Otmar Ertl (JIRA)" <ji...@apache.org> on 2014/10/07 20:25:34 UTC

[jira] [Comment Edited] (MATH-1124) Instances of AbstractRealDistribution require a random generator.

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

Otmar Ertl edited comment on MATH-1124 at 10/7/14 6:25 PM:
-----------------------------------------------------------

What about the C++ STL design choice? The corresponding Java design would be to pass a random generator instance to the sample method. For instance, have a look on the code example given on http://www.cplusplus.com/reference/random/uniform_real_distribution/

EDIT:
This would also allow the distribution classes to be entirely immutable.


was (Author: otmar ertl):
What about the C++ STL design choice? The corresponding Java design would be to pass a random generator instance to the sample method. For instance, have a look on the code example given on http://www.cplusplus.com/reference/random/uniform_real_distribution/

> Instances of AbstractRealDistribution require a random generator.
> -----------------------------------------------------------------
>
>                 Key: MATH-1124
>                 URL: https://issues.apache.org/jira/browse/MATH-1124
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Ajo Fod
>
> A couple of observations:
> ... The default random generator takes a while to instantiate. 
> ... Many functions of these distributions don't require a random generator. Generally speaking only sampling requires it.
> So, why force the default constructor to initialize with a new random generator ... why not use a global generic or simple generator? 
> Or do away with random generator except for sampling?
> This issue was observed with the TDistribution class , but it is probably applicable to many classes as well. 



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