packages feed

random 1.0.0.0 → 1.0.0.1

raw patch · 2 files changed

+10/−9 lines, 2 filesnew-uploader

Files

System/Random.hs view
@@ -86,10 +86,10 @@ -- the extended one expected in this module, so we lash-up a quick -- replacement here. #ifdef __NHC__-data ClockTime = TOD Integer ()+data ClockTime = TOD Integer Integer foreign import ccall "time.h time" readtime :: Ptr CTime -> IO CTime getClockTime :: IO ClockTime-getClockTime = do CTime t <- readtime nullPtr;  return (TOD (toInteger t) ())+getClockTime = do CTime t <- readtime nullPtr;  return (TOD (toInteger t) 0) #endif  -- | The class 'RandomGen' provides a common interface to random number@@ -132,7 +132,7 @@    genRange :: g -> (Int,Int)     -- default method-   genRange g = (minBound,maxBound)+   genRange _ = (minBound, maxBound)  {- | The 'StdGen' instance of 'RandomGen' has a 'genRange' of at least 30 bits.@@ -177,7 +177,7 @@ instance Read StdGen where   readsPrec _p = \ r ->      case try_read r of-       r@[_] -> r+       r'@[_] -> r'        _   -> [stdFromString r] -- because it shouldn't ever fail.     where        try_read r = do@@ -272,13 +272,13 @@ instance Random Char where   randomR (a,b) g =        case (randomIvalInteger (toInteger (ord a), toInteger (ord b)) g) of-        (x,g) -> (chr x, g)+        (x,g') -> (chr x, g')   random g	  = randomR (minBound,maxBound) g  instance Random Bool where   randomR (a,b) g =        case (randomIvalInteger (toInteger (bool2Int a), toInteger (bool2Int b)) g) of-        (x, g) -> (int2Bool x, g)+        (x, g') -> (int2Bool x, g')        where          bool2Int False = 0          bool2Int True  = 1@@ -317,11 +317,11 @@        n = iLogBase b k         f 0 acc g = (acc, g)-       f n acc g = +       f n' acc g =           let 	   (x,g')   = next g 	  in-	  f (n-1) (fromIntegral x + acc * b) g'+	  f (n' - 1) (fromIntegral x + acc * b) g'  randomIvalDouble :: (RandomGen g, Fractional a) => (Double, Double) -> (Double -> a) -> g -> (a, g) randomIvalDouble (l,h) fromDouble rng 
random.cabal view
@@ -1,9 +1,10 @@ name:		random-version:	1.0.0.0+version:	1.0.0.1 license:	BSD3 license-file:	LICENSE maintainer:	libraries@haskell.org synopsis:	random number library+category:       System description: 	This package provides a random number library. build-type: Simple