summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAntonis Geralis <43617260+planetis-m@users.noreply.github.com>2021-07-03 00:20:59 +0300
committerGitHub <noreply@github.com>2021-07-02 23:20:59 +0200
commitd1d2498c7b933b6364af450df5088aaa89b4cf4b (patch)
treef8e0ffb712326c257564e42677c800bc4a628d36 /lib
parent60eac79f7f0478565a24ff423aa52ab53527d153 (diff)
downloadNim-d1d2498c7b933b6364af450df5088aaa89b4cf4b.tar.gz
Add lent annotation to avoid extra copies in sample (#18404)
* Add lent annotation to avoid extra copies in sample

* Remove lent

* Update random.nim
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/random.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/random.nim b/lib/pure/random.nim
index 6a5f35bde..07db0365c 100644
--- a/lib/pure/random.nim
+++ b/lib/pure/random.nim
@@ -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