Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news7 From: Wojtek Newsgroups: comp.lang.java.programmer Subject: Re: RandomDirichlet? Date: Tue, 01 Nov 2011 04:54:36 -0700 Organization: NewsGuy - Unlimited Usenet $19.95 Lines: 29 Message-ID: References: NNTP-Posting-Host: p96c9af138f0eac2ea5fa47c39d56f968467f735967f0e78f.newsdawg.com Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit X-Newsreader: MesNews/1.08.03.00-gb Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9334 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 is your friend: java RandomDirichlet jgibblda.sourceforge.net -- Wojtek :-)