On Wed, 12 Nov 2003 12:00:06 -0500, "Liaw, Andy" <[EMAIL PROTECTED]>
wrote :


>This is obviously not efficient in high-level languages like R, but in terms
>of algorithm, it is a lot more efficient than check-and-reject.  IMHO this
>should be described in some book, but I have not seen any book describing
>it.

That's a variation on the standard shuffling algorithm, which is
described in Knuth (but is not original to him). What you described
takes time n but uses storage N.  There's also a very similar
variation that takes time N and storage n; this is equivalent to the
McLeod and Bellhouse (1983) sampling algorithm.

Duncan murdoch

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to