[R] about loops
David Winsemius
dwinsemius at comcast.net
Thu Jan 21 13:52:31 CET 2010
On Jan 21, 2010, at 7:28 AM, Wolfgang Amadeus wrote:
> Hello !
> I have a quick question about loops.
> For example, I have a 1 * 1 square and its inscribed circle tangent
> i, whose radius, of course, is also 1.
> The loop here is as the following:
> generate n points, say 5, in the square randomly repeatedly until we
> have five in total in the circle, then we stop, otherwise we continue.
> I do not know how !
> Help me Please ~
> Thank you very much for your time.
> Yours
> Wolfgang Amadeus
What part don't you know how to do? Sounds like homework (especially
with the piteous appeals from a pseudonym), so we expect more evidence
of effort on your part.
The condition for being "outside", assuming this box's lower left-hand
corner is (0,0) is
(x-0.5)^2 + (y-0.5)^2 > 1
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list