%
%  RandDots.m -- random dots -- djm -- 28 jan 2010
%

%  parameters
N = 25;  dx = 1/N;
x = -1:dx:1;  y = x;

%  matrices of coordinates
[xg,yg] = meshgrid(x,y);

%  plots of circles
figure(1);  clf
plot(xg,yg,'ro');  hold on

axis equal;  axis square

%  matrix of random numbers in [0,1]
rg = rand(size(xg));

%  keep only random set of ~fract of the dots
fract = 1/10;
rg = rg.*(rg < fract);

%  list of non-zero entries:  "help find"
list = find(rg);

%  plots of dots with density = fract
plot(xg(list),yg(list),'k.');

actual_fract = size(list,1)/size(xg(:),1)
