Skip to content

Instantly share code, notes, and snippets.

@stochastic-thread
Created September 9, 2014 01:50
Show Gist options
  • Save stochastic-thread/e23ebe8fd0daa12f626d to your computer and use it in GitHub Desktop.
Save stochastic-thread/e23ebe8fd0daa12f626d to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
class Array
def avg
self.inject(:+).fdiv(self.length)
end
end
g = [5,4,6,5,5,6,7,6,4,234234,2,4,4,3,43]
puts g.avg
@stochastic-thread
Copy link
Author

Shit I can't run code? Whats the point of gists then... this is stupid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment