Permalink
Browse files

Update some docs.

  • Loading branch information...
bos committed Sep 28, 2011
1 parent 735971e commit 3db6b508e55f3370a1cb0994449d9b543b7d065e
Showing with 9 additions and 3 deletions.
  1. +9 −3 System/Random/MWC.hs
View
@@ -284,10 +284,12 @@ create = initialize defaultSeed
-- verbatim, then its elements are 'xor'ed against elements of the
-- default seed until 256 elements are reached.
--
--- If a seed contains exactly 258 elements last two elements are used
--- to set generator state. It's to ensure that @gen' == gen@
+-- If a seed contains exactly 258 elements, then the last two elements
+-- are used to set the generator's initial state. This allows for
+-- complete generator reproducibility, so that e.g. @gen' == gen@ in
+-- the following example:
--
--- > gen' <- initialize . fromSeed =<< save
+-- @gen' <- 'initialize' . 'fromSeed' =<< 'save'@
initialize :: (PrimMonad m, Vector v Word32) =>
v Word32 -> m (Gen (PrimState m))
initialize seed = do
@@ -376,6 +378,10 @@ acquireSeedSystem = do
-- pseudo-random numbers (\"\/dev\/urandom\" on Unix-like systems),
-- then run the given action.
--
+-- This is a heavyweight function, intended to be called only
+-- occasionally (e.g. once per thread). You should use the `Gen` it
+-- creates to generate many random numbers.
+--
-- /Note/: on Windows, this code does not yet use the native
-- Cryptographic API as a source of random numbers (it uses the system
-- clock instead). As a result, the sequences it generates may not be

0 comments on commit 3db6b50

Please sign in to comment.