monte carlo?
<pseudocode>
found=false
sigma2=3; // variance
centrex=8; centrey=8; // centre point
while !found
x=random(15) //for a 15x15 grid of course!
y=random(15)
r2=(x-centrex)^2 + (y-centrey)^2 // squared distance to chosen point
p=exp(-r2/sigma) // probability of accepting this point
if(p>rand(1)) found=true; // (calcluated as gaussian distribution)
end
</pseudocode>
You can choose your distribution using the formula on the p=
line.
here the spread of the distribution can be controlled using the sigma
value. For a flat distribution just use p=r2<9
for a radius of 3 for example.
for a gaussian, the radius and density are essentially the same thing, as the integral of p
over x
and y
has to add up to 1.