Number reversal game: Difference between revisions

Updated to work with Nim 1.4: replaced "import math" with "import random". Removed proc "shuffle" which is provided by module "random".
(Added 11l)
(Updated to work with Nim 1.4: replaced "import math" with "import random". Removed proc "shuffle" which is provided by module "random".)
Line 2,388:
 
=={{header|Nim}}==
<lang nim>import mathrandom, rdstdin, strutils, algorithm
randomize()
 
proc shuffle[T](x: var seq[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