Skip to content

Instantly share code, notes, and snippets.

@randland
Created June 29, 2010 21:53
Show Gist options
  • Save randland/457873 to your computer and use it in GitHub Desktop.
Save randland/457873 to your computer and use it in GitHub Desktop.
def random_in(a, *b)
b.any? ? [a, *b][rand(b.count+1)] : a.to_a[rand(a.count)]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment