Skip to content

Instantly share code, notes, and snippets.

@mauro3
Created June 10, 2014 21:34
Show Gist options
  • Save mauro3/8745144b120763fbf225 to your computer and use it in GitHub Desktop.
Save mauro3/8745144b120763fbf225 to your computer and use it in GitHub Desktop.
n = 200
reps = 10^4
orderedinds = [1:n]
disorderedinds = orderedinds[randperm(n)]
function frows()
acc = 0
inds = disorderedinds
for i in rand(1:n, reps)
acc += sortperm(inds)[1]
end
acc
end
a = frows()
@time frows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment