 M:: cmwc random-32* ( cmwc -- n )
     cmwc dup mod>> '[ 1 + _ bitand ] change-i
     [ a>> ]
-    [ [ i>> ] [ Q>> ] bi nth * ]
+    [ [ i>> ] [ Q>> ] bi nth-unsafe * ]
     [ c>> + ] tri :> t!
 
     t -32 shift cmwc (>>c)

        swap >>a
        swap [ 1 - >>i ] [ <uint-array> >>Q ] bi
        dup b>> 1 - >>r
        dup Q>> length 1 - >>mod ;

: <cmwc-seed> ( Q c -- cmwc-seed )
    cmwc-seed boa ; inline

! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types arrays fry kernel locals math
math.bitwise random sequences sequences.private
specialized-arrays specialized-arrays.instances.uint ;
IN: random.cmwc

! Multiply-with-carry RNG
