#!/usr/bin/ruby

#
## https://rosettacode.org/wiki/Constrained_random_points_on_a_circle
#

var points = [];
while (points.len < 100) {
    var (x, y) = 2.of{31.irand - 15}...;
    var r2 = (x**2 + y**2);
    if ((r2 >= 100) && (r2 <= 225)) {
        points.append([x, y]);
    }
}
 
print <<'HEAD';
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox 0 0 400 400
200 200 translate 10 10 scale
0 setlinewidth
1 0 0 setrgbcolor
0 0 10 0 360 arc stroke
0 0 15 360 0 arcn stroke
0 setgray
/pt { .1 0 360 arc fill } def
HEAD
 
points.each { |pt| say "#{pt.join(' ')} pt" };
print '%%EOF';
