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
·············@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