
9 Jan
2011
9 Jan
'11
7:44 p.m.
betterStdGen :: IO StdGen betterStdGen = alloca $ \p -> do h <- openBinaryFile "/dev/urandom" ReadMode hGetBuf h p $ sizeOf (undefined :: Int) hClose h mkStdGen <$> peek p picoSec :: IO Integer picoSec = do t <- ctPicosec `liftM` (getClockTime >>= toCalendarTime) return t The pseudo-code is : if doesFileExist "/dev/urandom" then myGen = betterStdGen else myGen = (mkStdGen . fromTnteger) <$> picoSec How to write these pseudo-code elegantly ? Sincerely! ----- e^(π.i) + 1 = 0 -- View this message in context: http://haskell.1045720.n5.nabble.com/How-to-write-such-a-code-elegantly-tp33... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.