julia
b680b4eb - faster rand(::RandomDevice, NTuple{N, UInt}) (#58288)

Commit
228 days ago
faster rand(::RandomDevice, NTuple{N, UInt}) (#58288) `RandomDevice` uses `Libc.getrandom!` to get randomness, but such a system call is very expensive. There was already a specialization for `rand!` on `Array`s of builtin integers to have only one such call; this commit adds a similar specialization for homogeneous tuples of builtin integer types. One motivation is to instantiate `Xoshiro()` faster from `RandomDevice()`, as requesting 4*64 bits of entropy from the system in one go is, at least on my system, roughly 4 times faster that in 4 calls: ``` julia> @btime Xoshiro() 1.225 μs (1 allocation: 48 bytes) # master 319.068 ns (1 allocation: 48 bytes) # PR ```
Author
Parents
Loading