Comments
Sorry for the late reply. I just had time to think about your question that you asked during today's office hour.
You may assign the generated random number to a variable in a do block. Then you may use that variable as many times as you want in that do block.
See below. The body of the do block is boxed. Note that y is always equal to x + 1 + x * x.
-- Code starts here.
module Test where
import System.Random
foo x = x + 1
bar x = x * x
testCode = do
x <- randomRIO (0,100::Int) -- Now you may use x as a randomly generated number. print x y <- return (foo x + bar x) print y