You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it safe to start a random number generator and using @turbo to vectorize the process of filling an array? like
using LoopVectorization, Random
rng = MersenneTwister(0)
a = zeros(100)
@turbo for i in eachindex(a)
a[i] = randn(rng)
end
I wonder whether it will cause redundance of entries. I can test on my computer, but I would like to know whether the behavior is guaranteed to be correct from its principle.
Thanks very much!
The text was updated successfully, but these errors were encountered:
It will cause redundancy of entries/will not be valid.
If you'd like a faster random number generator, you can try https://github.com/JuliaSIMD/VectorizedRNG.jl
I never optimized it for generating single numbers at a time, but randn! or rand! methods for filling arrays should be fast. It can also fuse multiplying and adding numbers for different ranges, e.g. randn!(local_rng(), dst, static(0), mu, sigma) should sample from a Normal(mu, sigma).
Hi,
Is it safe to start a random number generator and using @turbo to vectorize the process of filling an array? like
I wonder whether it will cause redundance of entries. I can test on my computer, but I would like to know whether the behavior is guaranteed to be correct from its principle.
Thanks very much!
The text was updated successfully, but these errors were encountered: