]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 11 Sep 2008 06:11:59 +0000 (01:11 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 11 Sep 2008 06:11:59 +0000 (01:11 -0500)
basis/random/random.factor
extra/random/blum-blum-shub/blum-blum-shub-tests.factor
extra/random/blum-blum-shub/blum-blum-shub.factor

index 515c464a5a216df82938f862d2f232c4632ede5b..5ee45e6729412a60be89ab6d7a215da77877ee8e 100755 (executable)
@@ -14,7 +14,7 @@ GENERIC: random-32* ( tuple -- r )
 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> ;
 
index 9ace53ab252fceec4aa7271f1f2bca29a6160bfa..4b0dee642e7e9d7c4314c3a5a6b0da460a41af0b 100644 (file)
@@ -11,14 +11,12 @@ IN: blum-blum-shub.tests
 [ 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
 
index e60990075c0a27c24ed413c33b80970118bef062..8e9f0e25522e75de0015666e018c22ea04793ed5 100755 (executable)
@@ -13,7 +13,7 @@ TUPLE: blum-blum-shub x n ;
     [ [ 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>