[R] question on runif

Carl Witthoft carl at witthoft.com
Wed Jan 20 23:55:35 CET 2010


While I agree that this is someone's homework,  it occur to me that we 
can mess him up a little more.

He asked for 200 points *uniformly* distributed on (or in) a circle. 
Well,  he did NOT say "uniform random distribution".

So in fact the plot, "on" a circle would be

theta <-seq(0,2*pi, by = pi/100 )  # plus or minus a couple
radius<-1

plot({x,y converted from theta, radius})


I'm not quite sure how one generates 200 uniformly distributed points 
inside a circle,-- which btw means "on a disc" .

Maybe simply requiring them to be arranged so that all nearest neighbor 
distances are the same  :-)


Carl



More information about the R-help mailing list