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

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to