On 10 January 2011 10:44, z_axis <z_a...@163.com> wrote:
>
> betterStdGen :: IO StdGen
> betterStdGen = alloca $ \p -> do
>   h <- openBinaryFile "/dev/urandom" ReadMode
>   hGetBuf h p $ sizeOf (undefined :: Int)
>   hClose h
>   mkStdGen <$> peek p

Maybe use a catch or something here and have it return "IO (Maybe
StdGen)", with Nothing denoting that file not existing?

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to