Task

Generate 100 <x,y> coordinate pairs such that x and y are integers sampled from the uniform distribution with the condition that 




10
≤



x

2


+

y

2




≤
15


{\displaystyle 10\leq {\sqrt {x^{2}+y^{2}}}\leq 15}

. 
Then display/plot them. The outcome should be a "fuzzy" circle. The actual number of points plotted may be less than 100, given that some pairs may be generated more than once.

There are several possible approaches to accomplish this. Here are two possible algorithms.

1) Generate random pairs of integers and filter out those that don't satisfy this condition:





10
≤



x

2


+

y

2




≤
15


{\displaystyle 10\leq {\sqrt {x^{2}+y^{2}}}\leq 15}

.
2) Precalculate the set of all possible points (there are 404 of them) and select randomly from this set.




(import
  math [sqrt]
  random [choice]
  matplotlib.pyplot :as plt)
 
(setv possible-points 
  (lfor
    x (range -15 16) 
    y (range -15 16)
    :if (<= 10 (sqrt (+ (** x 2) (** y 2))) 15)
	  [x y]))
 
(setv [xs ys] (zip #* (map (fn [_] (choice possible-points)) (range 100))))
  ; We can't use random.sample because that samples without replacement.
  ; #* is also known as unpack-iterable
(plt.plot xs ys "bo")
(plt.show)