So I am finding V values of a Wilcoxon sum ranked test from 10 uniformly distributed RV's. I can do this once like this
uniform=runif(10,min=0,max=1)
diff <- c(uniform - .5)
diff <- diff[ diff!=0 ]
diff.rank <- rank(abs(diff))
diff.rank.sign <- diff.rank * sign(diff)
ranks.pos <- sum(diff.rank.sign[diff.rank.sign > 0])
but now I need to repeat this process 10,000 times and make a histogram out of it. How can I do this?