Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 82087 invoked from network); 27 Oct 2009 00:21:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Oct 2009 00:21:46 -0000 Received: (qmail 63664 invoked by uid 500); 27 Oct 2009 00:21:45 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 63549 invoked by uid 500); 27 Oct 2009 00:21:45 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 63539 invoked by uid 99); 27 Oct 2009 00:21:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Oct 2009 00:21:45 +0000 X-ASF-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ted.dunning@gmail.com designates 209.85.216.200 as permitted sender) Received: from [209.85.216.200] (HELO mail-px0-f200.google.com) (209.85.216.200) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Oct 2009 00:21:40 +0000 Received: by pxi38 with SMTP id 38so2916512pxi.10 for ; Mon, 26 Oct 2009 17:21:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=/EN9Y2hk7E4+ZqMAuSkwWqapev+L7gnLOfVS/+sHN3k=; b=EElNYIXs9U2/S2P2hwUZXSGc1lnVeMmGMUiKT+9NNmaKr8Sb3a/h85G6BA0ixuip/R u2bzQlaKmdLAwYR86tcgoBYFh2SXlsqXZmWSZ0sn5UywylQ/Pl6Z1T0YtjoyQWkwu0JX DEsP3Xyw1By+YohcTa/d3LlENo4vVqET5CSVk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=ZSxC9D0SKBpttDendviRh7jKvUbiNvdFIlWYYdFebMPaJW11G3g7LpD3mcGm2qTim8 Xn2AQSsEnogh9SLk+jgSEATaDEJCNhGMnByO6vleL83PDbmewH6lDqPnqxctl4RisZuV +eOl/aR6+Q5rg5P+dg2ZvBAOLJ/VFhlq+n344= MIME-Version: 1.0 Received: by 10.114.33.14 with SMTP id g14mr24375550wag.124.1256602880228; Mon, 26 Oct 2009 17:21:20 -0700 (PDT) In-Reply-To: <4AE635AF.2050408@gmail.com> References: <3796c6d50910261509n70c5f326yd5ab9eef2b74c92c@mail.gmail.com> <4AE635AF.2050408@gmail.com> From: Ted Dunning Date: Mon, 26 Oct 2009 17:21:00 -0700 Message-ID: Subject: Re: [math] Generate random data using the Inverse CDF Method? To: Commons Developers List Content-Type: multipart/alternative; boundary=001636b149994cbee20476dfa8bd --001636b149994cbee20476dfa8bd Content-Type: text/plain; charset=UTF-8 It is similar to what RandomDataImpl does, but the current type hierarchy is a problem because it over-uses that interface/factory/implementation pattern. The result is confusing as can be, especially since virtually all of the distributions have just one implementation and the factories aren't polymorphic. This causes the reader (*this* reader anyway) to be completely convinced that there is more code hidden somewhere. The approach suggested by Mikkel seems much better than the current one. On Mon, Oct 26, 2009 at 4:50 PM, Phil Steitz wrote: > > With this small change, a new class called > > RandomDistributionWithInverseCumulativeProbability (again, who has a > > better name?) could simply use the uniform generator and a class > > implementing DistributionWithInverseCumulativeProbability to generate > > random data from that distribution. > > This is essentially what RandomDataImpl does for the distributions > that it supports. Support for more distributions would be a welcome > addition. I guess along the lines of what you are talking about > above, it might make sense to add a single generic > nextInversionDeviate method paramaterized by ContinuousDistribution. > The implementation of this would use a uniform generator and > inversion to generate deviates. That would be simpler than creating > separate classes for each distribution or adding random data > generation to the distributions themselves. It would also be more > consistent with the current organization of the code, which locates > random data generation in the random package. > -- Ted Dunning, CTO DeepDyve --001636b149994cbee20476dfa8bd--