Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 79BA4C9FC for ; Tue, 29 May 2012 07:22:25 +0000 (UTC) Received: (qmail 92558 invoked by uid 500); 29 May 2012 07:22:25 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 92350 invoked by uid 500); 29 May 2012 07:22:24 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 92309 invoked by uid 99); 29 May 2012 07:22:23 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 07:22:23 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 820C1142858 for ; Tue, 29 May 2012 07:22:23 +0000 (UTC) Date: Tue, 29 May 2012 07:22:23 +0000 (UTC) From: "Dennis Hendriks (JIRA)" To: issues@commons.apache.org Message-ID: <1207322034.10101.1338276143534.JavaMail.jiratomcat@issues-vm> In-Reply-To: <1157671132.32254.1331111338038.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (MATH-764) New sample() API should accept RandomGenerator as parameter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13284644#comment-13284644 ] Dennis Hendriks commented on MATH-764: -------------------------------------- bq. A aimple way to provide the requested functionality without breaking compatibility might be to add setRandomGenerator methods to AbstractXxxDistribution. This violates immutability, but the reseedRandomGenerator methods currently provided arguably do this already with essentially the same practical consequences. Would it not be better to allow passing in a RandomData instance via the constructors? That way, instead of constructing a default RandomDataImpl with default random generator, the user can provide their own RandomData, which they constructed using their own random generator. This way, the distributions are still immutable. > New sample() API should accept RandomGenerator as parameter > ----------------------------------------------------------- > > Key: MATH-764 > URL: https://issues.apache.org/jira/browse/MATH-764 > Project: Commons Math > Issue Type: Improvement > Affects Versions: 3.0 > Reporter: Alex Bertram > Attachments: sampler-refactor.diff > > Original Estimate: 48h > Remaining Estimate: 48h > > This may come to late as I know the 3.0 release is nearing completion, but I had some concerns about the new sample() method on the math3 RealDistribution interface. > Specifically, there doesn't seem to be a way to supply a random generator to the sampler. Perhaps it would be better to have a factory method on the RealDistribution interface that accepted a RandomGenerator and returns an instance of some new interface, Sampler, which contains the sample() methods. > That is: > interface RealDistribution { > Sampler createSampler(RandomGenerator generator); > Sample createSampler(); // uses default RandomGenerator > } > interface Sampler { > double sample(); > double[] sample(int sampleSize); > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira