mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-03 18:34:43 +00:00
Add lent annotation to avoid extra copies in sample (#18404)
* Add lent annotation to avoid extra copies in sample * Remove lent * Update random.nim
This commit is contained in:
@@ -410,7 +410,7 @@ proc sample*[T](r: var Rand; a: openArray[T]): T =
|
||||
|
||||
result = a[r.rand(a.low..a.high)]
|
||||
|
||||
proc sample*[T](a: openArray[T]): T =
|
||||
proc sample*[T](a: openArray[T]): lent T =
|
||||
## Returns a random element from `a`.
|
||||
##
|
||||
## If `randomize <#randomize>`_ has not been called, the order of outcomes
|
||||
|
||||
Reference in New Issue
Block a user