     [ 0 >>i drop ] bi ;
 
 : init-mt-first ( seed -- seq )
-    >r mt-n 0 <array> r>
+    >r mt-n 0 <array> <circular> r>
     HEX: ffffffff bitand 0 pick set-nth ;
 
 : init-mt-formula ( seq i -- f(seq[i]) )

    tuck [ nth mt-hi ] [ nth mt-lo ] 2bi* bitor ; inline

: (mt-generate) ( n mt-seq -- y to from-elt )
    [ >r dup 1+ mt-wrap r> calculate-y ]
    [ >r mt-m + mt-wrap r> nth ]
    [ drop ] 2tri ;

: mt-generate ( mt -- )

! http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c

USING: arrays kernel math namespaces sequences system init
accessors math.ranges random circular ;
IN: random.mersenne-twister

<PRIVATE
