Extend ndarray-rand to be able to randomly sample from ArrayRef#1540
Merged
akern40 merged 4 commits intorust-ndarray:masterfrom Nov 3, 2025
Merged
Extend ndarray-rand to be able to randomly sample from ArrayRef#1540akern40 merged 4 commits intorust-ndarray:masterfrom
ndarray-rand to be able to randomly sample from ArrayRef#1540akern40 merged 4 commits intorust-ndarray:masterfrom
Conversation
Prior to `ndarray` 0.17, the `RandomExt` trait exposed by `ndarray-rand` contained methods for both creating new arrays randomly whole-cloth (`random_using`) and sampling from existing arrays (`sample_axis_using`). With the introduction of reference types in `ndarray` 0.17, users should be able to sample from `ArrayRef` instances as well. We choose to expose an additional extension trait, `RandomRefExt`, that provides this functionality. We keep the methods on the old trait for backwards compatibility, but collapse the implementation and documentation to the new trait to maintain a single source of truth.
ndarray-rand to be able to randomly sample from ArrayRef.ndarray-rand to be able to randomly sample from ArrayRef
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to
ndarray0.17, theRandomExttrait exposed byndarray-randcontained methods for both creating new arrays randomly whole-cloth (random_using) and sampling from existing arrays (sample_axis_using). With the introduction of reference types inndarray0.17, users should be able to sample fromArrayRefinstances as well.We choose to expose an additional extension trait,
RandomRefExt, that provides this functionality. We keep the methods on the old trait for backwards compatibility, but collapse the implementation and documentation to the new trait to maintain a single source of truth.