GENERIC: random-bytes* ( n tuple -- byte-array )
M: object random-bytes* ( n tuple -- byte-array )
- swap [ drop random-32* ] with map >c-uint-array ;
+ [ random-32* ] curry replicate [ 4 >le ] map concat ;
M: object random-32* ( tuple -- r ) 4 random-bytes* le> ;
[ 70576473 ] [
T{ blum-blum-shub f 590695557939 811977232793 } clone [
32 random-bits
- little-endian? [ <uint> reverse *uint ] unless
] with-random
] unit-test
[ 5570804936418322777 ] [
T{ blum-blum-shub f 590695557939 811977232793 } clone [
64 random-bits
- little-endian? [ <ulonglong> 4 group [ reverse ] map concat *ulonglong ] unless
] with-random
] unit-test
[ [ random-prime ] curry [ 4 mod 3 = ] generate ] dup bi ;
: next-bbs-bit ( bbs -- bit )
- [ [ x>> 2 ] [ n>> ] bi ^mod dup ] keep (>>x) 1 bitand ;
+ dup [ x>> 2 ] [ n>> ] bi ^mod [ >>x drop ] [ 1 bitand ] bi ;
PRIVATE>