Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update some docs.

  • Loading branch information...
commit 3db6b508e55f3370a1cb0994449d9b543b7d065e 1 parent 735971e
Bryan O'Sullivan authored September 27, 2011

Showing 1 changed file with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. 12  System/Random/MWC.hs
12  System/Random/MWC.hs
@@ -284,10 +284,12 @@ create = initialize defaultSeed
284 284
 -- verbatim, then its elements are 'xor'ed against elements of the
285 285
 -- default seed until 256 elements are reached.
286 286
 --
287  
--- If a seed contains exactly 258 elements last two elements are used
288  
--- to set generator state. It's to ensure that @gen' == gen@
  287
+-- If a seed contains exactly 258 elements, then the last two elements
  288
+-- are used to set the generator's initial state. This allows for
  289
+-- complete generator reproducibility, so that e.g. @gen' == gen@ in
  290
+-- the following example:
289 291
 --
290  
--- > gen' <- initialize . fromSeed =<< save
  292
+-- @gen' <- 'initialize' . 'fromSeed' =<< 'save'@
291 293
 initialize :: (PrimMonad m, Vector v Word32) =>
292 294
               v Word32 -> m (Gen (PrimState m))
293 295
 initialize seed = do
@@ -376,6 +378,10 @@ acquireSeedSystem = do
376 378
 -- pseudo-random numbers (\"\/dev\/urandom\" on Unix-like systems),
377 379
 -- then run the given action.
378 380
 --
  381
+-- This is a heavyweight function, intended to be called only
  382
+-- occasionally (e.g. once per thread).  You should use the `Gen` it
  383
+-- creates to generate many random numbers.
  384
+--
379 385
 -- /Note/: on Windows, this code does not yet use the native
380 386
 -- Cryptographic API as a source of random numbers (it uses the system
381 387
 -- clock instead). As a result, the sequences it generates may not be

0 notes on commit 3db6b50

Please sign in to comment.
Something went wrong with that request. Please try again.