Hey quick question - if I want to draw samples from e.g. a gamma, or gaussian distribution, whatβs a good, fast clojure (or java) lib to use?
https://generateme.github.io/fastmath/fastmath.random.html
user> (def _ (add-lib 'org.scicloj/noj))
#'user/_
user> (require '[fastmath.random :as r])
nil
user> (take 10 (r/sequence-generator :gaussian 1))
(-0.1547736360816925
1.8051191792904466
-0.20709054853216552
0.5171728760064104
0.2498853318740287
0.5562857017358865
0.8022862755958767
0.251129872734826
-0.5441381558262343
-0.14407141024181996)
user> (r/->seq (r/distribution :gamma) 10)
(5.799961441228679
5.896788029044922
1.683425787924847
6.806011683813666
2.6057208109240175
7.701674091635153
5.631465984279382
1.401760757867204
5.219105035951475
0.7030695884782802)Nice! β¨
I'd just add that it is recommended to use Fastmath version 3 (even though it is marked as "alpha", the relevant parts are stable).
https://clojars.org/generateme/fastmath
Here is the documentation for version 3:
https://generateme.github.io/fastmath/clay/
The fabulous fastmath.random documentation is BTW thanks to the work of @mavbozo, who adapted the version 2 docs some time ago.
https://generateme.github.io/fastmath/clay/random.html
Ooh brilliant thanks so much!