Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rand dispatch for tuple types #50251

Merged
merged 16 commits into from
Sep 29, 2023
Prev Previous commit
Next Next commit
remove access to internal properties
  • Loading branch information
adienes committed Sep 23, 2023
commit 57f45e7bf3f8e109a2cf4fc6cc36cb7b1798f791
2 changes: 1 addition & 1 deletion stdlib/Random/src/generation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ end
### random tuples

function rand(r::AbstractRNG, ::SamplerType{T}) where {T<:Tuple}
ntuple(i -> rand(r, T.parameters[i]), Val(length(T.parameters)))
ntuple(i -> rand(r, fieldtype(T, i)), Val(fieldcount(T)))
end
stevengj marked this conversation as resolved.
Show resolved Hide resolved

## Generate random integer within a range
Expand Down