Number reversal game: Difference between revisions
Content added Content deleted
Alextretyak (talk | contribs) (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: | Line 2,388: | ||
=={{header|Nim}}== |
=={{header|Nim}}== |
||
<lang nim>import |
<lang nim>import random, rdstdin, strutils, algorithm |
||
randomize() |
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 = |
proc isSorted[T](s: openarray[T]): bool = |