Created
September 19, 2010 04:25
-
-
Save kblake/586381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_array = [0,0,0,0,0,0,0,0,0,0] | |
#populate array | |
100.times do | |
random_num = rand(100) + 1 | |
correct_index = (random_num == 100) ? 9 : random_num/10 | |
num_array[correct_index] += 1 | |
end | |
#print histrogram | |
for index in 0..9 | |
puts "#{(index*10) + 1}-#{(index+1)*10} \t| #{'*' * num_array[index]}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment