[a homework question] The following method is straightforward (from my thesis (and from my own brain)): --------------------- An algorithm for generating a random object $x$ where $x \in U \subset V$ ($U$ is the subset of all objects in $V$ that have a required property) is as follows. 1) Generate a random object $x \in V$. 2) If $x \in U$ then return it ($x$ is of the required type). 3) Go to step 1. --------------------- Now I have been asked (by one examiner) for a reference for this method, but surprisingly I cannot find anything. So trivial no one ever bothered to write down? Anyone? Btw. I call this thing the "rejection method". The example (square in a circle) at the bottom of the page http://en.wikipedia.org/wiki/Rejection_sampling would suggest that my algorithm is a special case of what is described on this page. However, I cannot see how it can be specialised from the Algorithm given just above it.