Sorting algorithms/Bogosort: Difference between revisions

Replaced “import math” by “import random”. Removed proc “shuffle” as it is now provided by the module “random”.
m (added Category:Sorting)
(Replaced “import math” by “import random”. Removed proc “shuffle” as it is now provided by the module “random”.)
Line 2,028:
 
=={{header|Nim}}==
<lang nim>import mathrandom
randomize()
 
randomize()
proc shuffle[T](x: var openarray[T]) =
for i in countdown(x.high, 0):
let j = random(i + 1)
swap(x[i], x[j])
 
proc isSorted[T](s: openarray[T]): bool =
Anonymous user