Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Aug 26, 2022
1 parent 2e9b884 commit 9cca29e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ type Vector
If a `Range`, the selection is specified by two indices, from and to.
take : (Index_Sub_Range | Range) -> Vector Any
take self range=(First 1) = case range of
## We are using a specialized implementation for `take Sample`, because
the default implementation (which needs to be generic for any
collection) generates a random set of indices and then selects these
indices, but we can sample the vector directly.
Index_Sub_Range.Sample count seed ->
rng = Random.new seed
Random.sample self count rng
Expand Down

0 comments on commit 9cca29e

Please sign in to comment.