Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

I'd like to propose a change for rand and rand-int. I'd like to add the possibility to call them with two parameters having the result is in that range.

I think it would be a useful change as now, when you want to get a random number in a range you have to google how to do it because you don't remember it and end up with something that is not obvious what it's doing:

(+ a (rand (- b a))

The change is simple (I've done it locally, build and tested it). Patch attached.


1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/CLJ-1884 (reported by jjconti)