Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,17 +1,17 @@
|
|||
(import '[java.awt Color Graphics Dimension]
|
||||
'[javax.swing JFrame JPanel])
|
||||
(ns rosettacode.circle-random-points
|
||||
(:import [java.awt Color Graphics Dimension]
|
||||
[javax.swing JFrame JPanel]))
|
||||
|
||||
(let [points (->> (for [x (range -15 16)
|
||||
y (range -15 16)
|
||||
:when (<= 10 (Math/sqrt (+ (* x x) (* y y))) 15)]
|
||||
(let [points (->> (for [x (range -15 16), y (range -15 16)
|
||||
:when (<= 10 (Math/hypot x y) 15)]
|
||||
[(+ x 15) (+ y 15)])
|
||||
shuffle
|
||||
(take 100 ,))]
|
||||
(take 100))]
|
||||
(doto (JFrame.)
|
||||
(.add (doto (proxy [JPanel] []
|
||||
(paint [^Graphics g]
|
||||
(doseq [[x y] points]
|
||||
(.fillRect g (* 10 x) (* 10 y) 10 10))))
|
||||
(doseq [[x y] points]
|
||||
(.fillRect g (* 10 x) (* 10 y) 10 10))))
|
||||
(.setPreferredSize (Dimension. 310 310))))
|
||||
(.setResizable false)
|
||||
(.setDefaultCloseOperation JFrame/DISPOSE_ON_CLOSE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue