swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sample collection without replacement


From: Theodore C. Belding
Subject: Re: sample collection without replacement
Date: Wed, 21 Aug 1996 16:10:18 -0400

At 2:40 PM -0400 8/21/96, Rick Riolo wrote:
>I'd like to know the recommended way to get
>some random samples without replacement from a collection (in particular
>a list if it matters).

Hi Rick! :)
Knuth gives 2 algorithms (v. 2, pp. 137ff.) for sampling n items without
replacement from a collection of N items, with probability of n/N for each
item.  One algorithm assumes N is known, the second doesn't.  Here's a C
implementation of the first algorithm.  This way you don't have to remove
agents from the collection, if that matters to you.
-Ted

Attachment: Select.c
Description: Text document

--
Ted Belding                        mailto:address@hidden
University of Michigan Program for the Study of Complex Systems
http://www-personal.engin.umich.edu/~streak/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]