This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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" | |
} |