Skip to content

Instantly share code, notes, and snippets.

@ninthdrug
ninthdrug / rock_paper_scissors.scala
Created November 13, 2012 22:00
Rock Paper Scissors in Scala
// rock paper scissors in scala
import scala.util.Random
def rockPaperScissors(): String = {
Random.nextDouble match {
case d if d < 1.0 / 3 => "rock"
case d if d < 2.0 / 3 => "paper"
case _ => "scissors"
}