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:
Antonis Geralis
2021-07-03 00:20:59 +03:00
committed by GitHub
parent 60eac79f7f
commit d1d2498c7b

View File

@@ -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