Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 84860 invoked from network); 27 Oct 2009 13:04:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Oct 2009 13:04:11 -0000 Received: (qmail 35258 invoked by uid 500); 27 Oct 2009 13:04:10 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 35128 invoked by uid 500); 27 Oct 2009 13:04:10 -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 35118 invoked by uid 99); 27 Oct 2009 13:04:10 -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 13:04:10 +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.160.51 as permitted sender) Received: from [209.85.160.51] (HELO mail-pw0-f51.google.com) (209.85.160.51) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Oct 2009 13:04:07 +0000 Received: by pwi19 with SMTP id 19so59267pwi.10 for ; Tue, 27 Oct 2009 06:03:47 -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=ozE102uZmbedSjPsReFGdCF4CVEcERCYuiDu48iv6lY=; b=IMGrYZnpZmjCtHBVQqPuZdWDePlZIdEoxAzaIVyGchOOEUBfFOP9zhRCAFxCSaryjB 4DOaHxkWDYu5GdSvQL9rEhybRrYVXvhVMlx5ts/KK+P7BeQFBb7ZVSDdnga5ykifDQI/ 7x5l18ATpOgYu2ZS63NXijiDGDpR2VmwUDVxI= 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=fpkzmaEFj01rbfmeY6kp9zm8ItSpX+GwuSuGZsQjYRFM4FPz+k+E9dCwUVY8fYuN2f pgpXuiNN8pr+C9UnBL3aUw/C04Owrhsh2Xi3heYSxcPVrkiT1XC8lCF+BWOJVU1O9Mgk MHf01b0/3d5RSIVN5nvVO+GZX3MhBdWczEfFk= MIME-Version: 1.0 Received: by 10.115.149.10 with SMTP id b10mr11073354wao.157.1256648627122; Tue, 27 Oct 2009 06:03:47 -0700 (PDT) In-Reply-To: <3796c6d50910270408x4635d26h9fdc5b4f29f06c3c@mail.gmail.com> References: <3796c6d50910261509n70c5f326yd5ab9eef2b74c92c@mail.gmail.com> <4AE639E4.2080702@gmail.com> <3796c6d50910261711y279cfe05x992c716db723c91b@mail.gmail.com> <3796c6d50910261733v520c6f9bxef9e4e14ffc8f86@mail.gmail.com> <4AE6465E.5040809@gmail.com> <3796c6d50910261901k389e89fdj8cc589d6a08cf1cb@mail.gmail.com> <3796c6d50910270408x4635d26h9fdc5b4f29f06c3c@mail.gmail.com> From: Ted Dunning Date: Tue, 27 Oct 2009 06:03:27 -0700 Message-ID: Subject: Re: [math] Generate random data using the Inverse CDF Method? To: Commons Developers List Content-Type: multipart/alternative; boundary=0016e646a2d206f4b10476ea4f3a --0016e646a2d206f4b10476ea4f3a Content-Type: text/plain; charset=UTF-8 Mikkel, Hate to put you to extra work here, but take a look here: http://commons.apache.org/math/issue-tracking.html The idea is that you file an issue with JIRA and attach your patch there. In order to encourage that, this mailing list strips attachments. On Tue, Oct 27, 2009 at 4:08 AM, Mikkel Meyer Andersen wrote: > I've attached a prototype diff-proposal where I've changed > AbstractContinuousDistribution and AbstractIntegerDistribution, and > implemented the nextExponential on the ExponentialDistribution as an > example of overwriting the nextSample-method from the > Abstract-distributions. > > Only AbstractContinuousDistribution and AbstractIntegerDistribution > extends AbstractDistribution, and both AbstractIntegerDistribution and > AbstractContinuousDistribution has an > inverseCumulativeProbability-function. But in > AbstractContinuousDistribution the inverse cdf returns a double, and > at AbstractIntegerDistribution it - naturally - returns an integer. > Therefor the nextSample is not put on AbstractDistribution, but on > each extension with different return types. > > RandomGenerator as parameter instead of getting a RNG inside the > nextSample, because one typically wants to use the same RNG because > often several random samples are wanted. Another option is to have a > RNG as a field in the class, but that would be more ugly and also > result in several RNGs at runtime. > > I found an error as well. In RandomDataImpl, mean < 0 throws > exception, whereas in the distribution implementation an exception is > thrown if mean <= 0. RandomDataImpl is corrected to <= in because that > is the correct definition. > > The function nextExponential couldn't - without further notice - be > removed from RandomDataImpl, because nextPoisson and the ValueServer > uses the function directly. So here is an issue. nextPoisson can > create a ExponentialDistribution and sample from that. ValueServer > could do the same, but what to you think about it? > > As mentioned, the diff is only a prototype hence no formal patch > submitted. And no tests has been made neither. But should I report a > bug or supply a separate patch on the small mean-problem in > nextExponential in RandomDataImpl? > > Cheers, Mikkel. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > -- Ted Dunning, CTO DeepDyve --0016e646a2d206f4b10476ea4f3a--