Commits

Aleksey Khudyakov committed 1f3bbf1

Add function to type class to generate uniform distributions in range

This function isn't implemented yet

Generation of uniform distrubutions in predfiened range for
integral numbers is not trivial. In particular using `mod` will
not result in uniform distribution.

  • Participants
  • Parent commits b091be9

Comments (0)

Files changed (1)

File System/Random/MWC.hs

     -- 2**(-33).  To do the same with 'Double' variates, subtract
     -- 2**(-53).
     uniform :: (PrimMonad m) => Gen (PrimState m) -> m a
+    -- | Generate single uniformly distributed random variable in a
+    -- given range.
+    --
+    -- * For integral types inclusive range is used.
+    --
+    -- * For floating point numbers range (a,b] is used.
+    uniformR :: (PrimMonad m) => (a,a) -> Gen (PrimState m) -> m a
 
 instance Variate Int8 where
     uniform = uniform1 fromIntegral