ZVON > References > Haskell reference |
Intro / Search / ZVON |
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | >> Random << |
Module: | Random |
---|---|
Function: | getStdRandom |
Type: | (StdGen -> (a, StdGen)) -> IO a |
Description: | uses the supplied function to get a value from the current global random generator, and updates the global generator with the new generator returned by the function. |
Related: |
Program source: import Random main = do a <- drawInt 1 10 b <- drawInt 1 10 x <- drawDouble 0.0 1.0 print a print b print x drawInt :: Int -> Int -> IO Int drawInt x y = getStdRandom (randomR (x,y)) drawDouble :: Double -> Double -> IO Double drawDouble x y = getStdRandom (randomR (x,y))
Output: 6
Output: 2
Output: 0.8674070605466624