Skip to content

Commit

Permalink
reformat with spork/fmt/format-file
Browse files Browse the repository at this point in the history
  • Loading branch information
Hörmet Yiltiz committed Jan 11, 2024
1 parent da6d029 commit 018bab4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spork/randgen.janet
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@
# We use the Box-Muller transform
(let [rho (math/sqrt (* -2 (math/log q)))
theta (* 2 math/pi p)
_box (* rho (math/cos theta))
_box (* rho (math/cos theta))
_muller (* rho (math/sin theta))
box (scale _box)
box (scale _box)
muller (scale _muller)]

(yield box)
muller))

(defn sample-n
(defn sample-n
"Generate n samples based on the random sampler f. E.g.
(sample-n |(rand-int 0 3) 4) # => @[0 1 2 0]
(sample-n |(rand-uniform) 4)
(sample-n |(rand-gaussian 5 0.1) 4)
"
[f n]
(take n (generate [_ :iterate true]
(take n (generate [_ :iterate true]
(f))))

(defn rand-index
Expand Down

0 comments on commit 018bab4

Please sign in to comment.