Skip to content

Instantly share code, notes, and snippets.

@emckean
Created June 13, 2012 17:26
Show Gist options
  • Save emckean/2925372 to your computer and use it in GitHub Desktop.
Save emckean/2925372 to your computer and use it in GitHub Desktop.
randomizr rememberr
1.9.3p125 :001 > wordniks = ["ramesh", "robert", "tony", "..."]
=> ["ramesh", "robert", "tony", "..."]
1.9.3p125 :002 > randomniks = wordniks.shuffle
=> ["ramesh", "tony", "robert", "..."]
1.9.3p125 :003 > half = randomniks.length/2
=> 2
1.9.3p125 :004 > teama = randomniks.slice(0, half)
=> ["ramesh", "tony"]
1.9.3p125 :005 > teamb = randomniks.slice(half, randomniks.length)
=> ["robert", "..."]
1.9.3p125 :006 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment