Skip to content

Instantly share code, notes, and snippets.

@pete
Created March 11, 2009 04:53
Show Gist options
  • Save pete/77321 to your computer and use it in GitHub Desktop.
Save pete/77321 to your computer and use it in GitHub Desktop.
mean = scores.inject(&:+) / scores.size
ssq = scores.inject(0) { |a,i| a + (i - mean) ** 2 }
min = scores[0] - Math.sqrt(ssq/scores.size) * 2
scores.delete_if { |score| score < min }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment