Skip to content

Conversation

aplavin
Copy link
Member

@aplavin aplavin commented Mar 25, 2023

can turn it into an 1.9 extension if Random is considered a dependency

@aplavin
Copy link
Member Author

aplavin commented May 5, 2023

Bump...

@piever
Copy link
Collaborator

piever commented May 5, 2023

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

@aplavin
Copy link
Member Author

aplavin commented May 6, 2023

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.

@aplavin
Copy link
Member Author

aplavin commented Jun 17, 2023

bump...

1 similar comment
@aplavin
Copy link
Member Author

aplavin commented Jul 13, 2023

bump...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants