mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 02:42:05 +00:00
Remove shuffle again
This commit is contained in:
@@ -284,14 +284,6 @@ proc random*[T](a: openArray[T]): T =
|
||||
## returns a random element from the openarray `a`.
|
||||
result = a[random(a.low..a.len)]
|
||||
|
||||
proc shuffle*[T](a: var openArray[T]) =
|
||||
## Shuffles the elements in `a`. Note that ``randomize`` needs to be called
|
||||
## to initialize the random number generator, otherwise ``shuffle`` always
|
||||
## shuffles in the same way.
|
||||
for i in countdown(a.high, 0):
|
||||
let j = random(i + 1)
|
||||
swap(a[i], a[j])
|
||||
|
||||
type
|
||||
RunningStat* = object ## an accumulator for statistical data
|
||||
n*: int ## number of pushed data
|
||||
|
||||
Reference in New Issue
Block a user