Skip to content

Instantly share code, notes, and snippets.

@mtimkovich
Created October 20, 2012 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtimkovich/3921808 to your computer and use it in GitHub Desktop.
Save mtimkovich/3921808 to your computer and use it in GitHub Desktop.
Random Capitals
object randomCapitals {
def randomUpper(sentence: String) = {
sentence.map(c =>
if (math.random > .5)
c.toUpper
else
c.toLower)
}
def main(args: Array[String]) {
args.foreach(s => print(randomUpper(s) + " "))
println()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment