Re:Julia 1.5 Highlights
by daxfohl on Monday August 03, 2020 @12:56PM
(#24040210)
How does rand get faster? I would think rand would be so well explored that all mature languages reuse the same implementation. Is it written in C or assembly, or does it ccall, or is it written in Julia itself?
[ Parent
| on HN ]
It is Julia all the way down.
julia> @which randn(1000)
randn(dims::Integer...) in Random at ~/Software/Julia/share/julia/stdlib/v1.5/Random/src/normal.jl:210
julia> @edit randn(1000)
# Opens the normal.jl file in your editor
julia> @run randn(1000)
# Starts the debugger in VSCode
Digging deeper, at least one of the PRs [1] is based on a 2018 paper [2][1] https://github.com/JuliaLang/julia/pull/29240 [2] https://arxiv.org/abs/1805.10941
I don't know Julia's implementation, but random number generation is far from being standard across languages. There are several algorithms with their own pros/cons, and as architectures change, so change the requirements on good random number generators.
> I would think rand would be so well explored
On the contrary, random number generation has no general solution and remains an active area of research in many fields that depend on it.