Skip to content

Instantly share code, notes, and snippets.

@mloc
Created February 21, 2019 11:40
Show Gist options
  • Save mloc/7878e18c35fe1f8d9707a3065c17cf2c to your computer and use it in GitHub Desktop.
Save mloc/7878e18c35fe1f8d9707a3065c17cf2c to your computer and use it in GitHub Desktop.
module main
let rand = new System.Random()
let swap (a: _[]) x y =
let tmp = a.[x]
a.[x] <- a.[y]
a.[y] <- tmp
let shuffle a =
Array.iteri (fun i _ -> swap a i (rand.Next(i, Array.length a))) a
let main() =
let langs = [|"Swift"; "F#"; "Rust"; "Nim"; "Go"; "Scala"; "R"; "Julia"; "Kotlin"; "Ruby"; "Typescript"; "C#"|]
shuffle langs
langs |> Seq.iter (printfn "%s")
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment