From: ·············@googlemail.com
Subject: Common Lisp: random sampling with replacement
Date: 
Message-ID: <1148462412.388116.255400@i39g2000cwa.googlegroups.com>
Dear all,

I am pretty new to Common-Lisp and I was looking whether a function
like the following one exists somewhere:

(defun sample (population probs n)
   ...

What  I expect this function to do is to draw a random sample of size n
from a population with replacement where each member has a (possibly
different) probability to be drawn.

Does anyone know of an implementation of that function in Common Lisp?

Thanks,
Roland

From: Juho Snellman
Subject: Re: Common Lisp: random sampling with replacement
Date: 
Message-ID: <slrne789tq.klj.jsnell@sbz-30.cs.Helsinki.FI>
·············@googlemail.com <·············@googlemail.com> wrote:
> Dear all,
> 
> I am pretty new to Common-Lisp and I was looking whether a function
> like the following one exists somewhere:
> 
> (defun sample (population probs n)
>    ...
> 
> What  I expect this function to do is to draw a random sample of size n
> from a population with replacement where each member has a (possibly
> different) probability to be drawn.
> 
> Does anyone know of an implementation of that function in Common Lisp?

Mario Mommer wrote a couple of blog posts about this last month:

http://prxq.wordpress.com/2006/04/17/the-alias-method/
http://prxq.wordpress.com/2006/04/23/more-on-the-alias-method/
http://common-lisp.net/~mmommer/alias_method_v2.lisp

-- 
Juho Snellman
From: ·············@googlemail.com
Subject: Re: Common Lisp: random sampling with replacement
Date: 
Message-ID: <1148465142.042699.77950@38g2000cwa.googlegroups.com>
Dear Juho,

a first look at the links looked very promising. Being a newcomer to
CL, it will take me awhile to digest the material.

Thanks,
Roland