Skip to content

Instantly share code, notes, and snippets.

@kenoir
Created October 8, 2012 20:27
Show Gist options
  • Save kenoir/3854773 to your computer and use it in GitHub Desktop.
Save kenoir/3854773 to your computer and use it in GitHub Desktop.
Find random position in a hash
chain = {
:a => 1,
:b => 2,
:c => 3
}
(rand * chain.length).round.times do
start = chain.each.next
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment