Skip to content

Instantly share code, notes, and snippets.

@furu
Created June 11, 2017 13:41
Show Gist options
  • Save furu/0492cc654b3e81a6066a7da64d83fed2 to your computer and use it in GitHub Desktop.
Save furu/0492cc654b3e81a6066a7da64d83fed2 to your computer and use it in GitHub Desktop.
import System.Random
main :: IO ()
main = do
gen <- getStdGen
putStrLn $ message $ dice1d100 gen
dice1d100 :: StdGen -> Int
dice1d100 gen = fst $ randomR (1, 100) gen
message :: Int -> String
message n
| n <= 5 = "サイコロの結果は" ++ show n ++ "で、クリティカルです!"
| n >= 96 = "サイコロの結果は" ++ show n ++ "で、ファンブルです!"
| otherwise = "サイコロの結果は" ++ show n ++ "です!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment