StructArrays.jl
StructArrays.jl copied to clipboard
rand() returns structarray
can turn it into an 1.9 extension if Random is considered a dependency
Bump...
Do other array libraries do this? It seems to me that rand always returns a plain array, regardless of the type of the container with the options:
julia> using Random
julia> s = [1, 2];
julia> rand(Random.MersenneTwister(), s, (3,))
3-element Vector{Int64}:
2
1
2
julia> rand(Random.MersenneTwister(), Set(s), (3,))
3-element Vector{Int64}:
2
1
2
julia> using CUDA
julia> rand(Random.MersenneTwister(), CUDA.cu(s), (3,))
3-element Vector{Int64}:
1
2
2
Do other array libraries do this?
That's a barrier for introducing any behavior in the first place, because at some point no packages do <insert anything> :)
I think it makes sense, if rand returned structarray then B = rand(A, length(A)) and A could be used completely interchangeably, eg for bootstrap sampling.
bump...
bump...