-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure
rand(sampler, dims)
works (#51643)
For any object `x` from which one can sample, the `Random` API also requires that `rand(rng, Sampler(typeof(rng), x), [dims])` works. So add tests for that, and fix `rand(Tuple{...})` accordingly, which was not using `SamplerTag` fully correctly. More precisely, the `Sampler` constructor for tuple types was returning a `SamplerTag` object whose `gentype` was returning the wrong type, leading to the wrong eltype of the output array for a call like `rand(rng, Sampler(rng, Tuple{...}), dims)`, so filling this array with random values was failing.
- Loading branch information
Showing
2 changed files
with
42 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters