StatisticalRethinkingJulia / StatisticalRethinking.jl

Julia package with selected functions in the R package `rethinking`. Used in the SR2... projects.
MIT License
386 stars 32 forks source link

Use rand(...) instead of rand(..., 1)[1] #104

Closed rikhuijzer closed 3 years ago

rikhuijzer commented 3 years ago

Hi! I noticed that some nested loops calculate rand(d, 1)[1] a lot. This can be sped up by using rand().

julia> using Random

julia> Random.seed!(1234); rand(1)[1]
0.5908446386657102

julia> Random.seed!(1234); rand()
0.5908446386657102
rikhuijzer commented 3 years ago

I've spotted a few more occurrences and added them in 65c16ac.

goedman commented 3 years ago

Thanks a lot Rik!

goedman commented 3 years ago

StatisticalRethinking.jl v3 definitely needs quite a bit of attention. As soon as this disaster migration from Travis to GitHub actions is done it will go back on my priority list.

rikhuijzer commented 3 years ago

StatisticalRethinking.jl v3 definitely needs quite a bit of attention. As soon as this disaster migration from Travis to GitHub actions is done it will go back on my priority list.

No worries! :smile: Rome wasn't built in a day either

rikhuijzer commented 3 years ago

StatisticalRethinking.jl v3 definitely needs quite a bit of attention. As soon as this disaster migration from Travis to GitHub actions is done it will go back on my priority list.

By the way, feel free to notify me if CI is a problem at a later point. 😄 I like CI and have set up many things with it