Constrained random points on a circle: Difference between revisions
Content added Content deleted
Underscore (talk | contribs) (Added Hy.) |
|||
Line 1,143:
/ / / / / / / /
/ / /</pre>
=={{header|Hy}}==
<lang lisp>(import
[math [sqrt]]
[random [choice]]
[matplotlib.pyplot :as plt])
(setv possible-points (list-comp (, x y)
[x (range -15 16) y (range -15 16)]
(<= 10 (sqrt (+ (** x 2) (** y 2))) 15)))
(setv sample (list (take 100 (repeatedly (fn [] (choice possible-points))))))
(plt.plot (list (map first sample)) (list (map second sample)) "bo")
(plt.show)</lang>
=={{header|Icon}} and {{header|Unicon}}==
|