Skip to content

Instantly share code, notes, and snippets.

@deepfryed
Created August 11, 2010 06:10
Show Gist options
  • Save deepfryed/518568 to your computer and use it in GitHub Desktop.
Save deepfryed/518568 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'pp'
sets = [
[1, 2, 3],
[10, 20, 30, 40, 50, 55, 56],
[100, 200, 300, 400, 500, 600, 700]
]
scale = sets.flatten.max
# Get the max - min for each set.
normalized = sets.map do |set|
set.map {|value| scale * value.to_f / set.max }
end
pp normalized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment