I believe it would mean something like that in Haskell (I'm not really confortable enough with Monad so there is room to improvements).
import System.Random (getStdGen, randomR) hasHit :: IO Bool hasHit = do g <- getStdGen return $ (>5) $ fst $ randomR (1 :: Int, 100) g main :: IO () main = do h <- hasHit print $ h -- True/False
And I would use this on each shot. Meaning I have 5/100 chance of missing my target. That is what I understood but I may be wrong on this one.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I believe it would mean something like that in Haskell (I'm not really confortable enough with Monad so there is room to improvements).
And I would use this on each shot. Meaning I have 5/100 chance of missing my target. That is what I understood but I may be wrong on this one.