Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/conformance98/random/Main.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


import Random

rollDie :: IO Int
rollDie = randomRIO (1, 6)

rollTwoDice :: IO (Int, Int)
rollTwoDice = do
	r1 <- rollDie
	r2 <- rollDie
	return (r1, r2)

main = do
	putStr "Sum of two dice: "
	(r1, r2) <- rollTwoDice
	print (r1 + r2)


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.