Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: RandomDirichlet? Date: Tue, 01 Nov 2011 07:50:01 -0400 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 1 Nov 2011 11:50:06 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="f8igmItKsWs6nM5YanFxAA"; logging-data="4423"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19X5RVfNPLoK1pd6SQMQzsI" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 In-Reply-To: Cancel-Lock: sha1:7b2mZT8iSBON0oDeQk4l3WU1OsI= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9333 On 11/1/2011 5:09 AM, Giovanni Azua wrote: > Hello, > > I need to generate random TPCH workloads but I don't want a Uniform > distribution where Q1, RF1, RF2 would be equally probable i.e. using new > Random().nextInt(..) > > I instead would like to draw samples from a Dirichlet distribution which > would give a very skewed PD depending on the input alphas (which specify how > skewed I want the PD to be). The Matlab code would be exactly: > > function r = dirichlet_sample(a,n) > p = length(a); > r = gamrnd(repmat(a,n,1),1,n,p); > r = r ./ repmat(sum(r,2),1,p); > End > > But there is no "gamrnd" RandomGamma in Java nor RandomDirichlet. Before I > spend time writing this, can anyone advice for a low-footprint library > implementing those functions? Google finds ~114,000 hits for "gamma distribution java". As an aside, Google finds ~396,000 hits for "dirichlet distribution java". Finally, Google finds ~111,000,000 hits for "people who never heard of google". I'm not sure just what that means ... -- Eric Sosman esosman@ieee-dot-org.invalid