Skip to content

rand(sa, ::Int) returns Vector #308

@jariji

Description

@jariji

Does this have to return Vector or could it return StructArray?

julia> sa = StructArray(a=[10,20,30], b=[100,200,300])
3-element StructArray(::Vector{Int64}, ::Vector{Int64}) with eltype @NamedTuple{a::Int64, b::Int64}:
 (a = 10, b = 100)
 (a = 20, b = 200)
 (a = 30, b = 300)

julia> rand(sa, 2)
2-element Vector{@NamedTuple{a::Int64, b::Int64}}:
 (a = 30, b = 300)
 (a = 20, b = 200)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions