Created
February 21, 2019 11:40
-
-
Save mloc/7878e18c35fe1f8d9707a3065c17cf2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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