 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.c-types kernel math namespaces sequences
 io.backend io.binary combinators system vocabs.loader
-summary math.bitwise ;
+summary math.bitwise byte-vectors fry byte-arrays ;
 IN: random
 
 SYMBOL: system-random-generator

GENERIC: random-32* ( tuple -- r )
GENERIC: random-bytes* ( n tuple -- byte-array )

M: object random-bytes* ( n tuple -- byte-array )
    [ random-32* ] curry replicate [ 4 >le ] map concat ;

M: object random-32* ( tuple -- r ) 4 random-bytes* le> ;



: random-bytes ( n -- byte-array )
    [
        dup adjust-random random-generator get random-bytes*
    ] keep head >byte-array ;

<PRIVATE

