Skip to content

Instantly share code, notes, and snippets.

@installero
Created May 27, 2017 17:06
Show Gist options
  • Save installero/4241bfe92cc66896e9bab2618935560d to your computer and use it in GitHub Desktop.
Save installero/4241bfe92cc66896e9bab2618935560d to your computer and use it in GitHub Desktop.
@filled = {
'num1' => 1, 'num2' => 2, 'num3' => 3,
'num4' => 4, 'num5' => 5, 'num6' => 6,
'num7' => 7, 'num8' => 8, 'num9' => 9
}
selected = @filled.to_a.select { |e| e[1] != 'text' }
while selected.any?
number = rand(9)
@filled["num#{number + 1}"] = 'text'
selected = @filled.to_a.select { |e| e[1] != 'text' }
puts @filled
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment