Skip to content

Instantly share code, notes, and snippets.

@manofstick
Created Aug 1, 2018
Embed
What would you like to do?
open System
open System.Diagnostics
for i = 1 to 5 do
let data =
let r = Random i
Array.init 2500 (fun _ ->
Seq.init (r.Next 50) (fun _ -> r.Next 3)
|> Set.ofSeq)
let sw = Stopwatch.StartNew ()
let mutable count = 0
for a in data do
for b in data do
if a < b then count <- count + 1
printfn "%d (%d)" sw.ElapsedMilliseconds count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment