Skip to content

Commit

Permalink
[#15] Fix implementation of random function
Browse files Browse the repository at this point in the history
  • Loading branch information
jfacorro committed Nov 11, 2021
1 parent d07258a commit d0eae6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/doodler/core.clje
Original file line number Diff line number Diff line change
Expand Up @@ -1169,9 +1169,9 @@
`(random -5 10.2)` returns values starting at -5 up to (but not
including) 10.2."
([max]
(dec (rand/uniform max)))
(* max (rand/uniform)))
([min max]
(+ min (dec (rand/uniform max)))))
(+ min (* (- max min) (rand/uniform)))))

(defn random-2d
"Returns a new 2D unit vector with a random direction"
Expand Down

0 comments on commit d0eae6e

Please sign in to comment.