X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=basis%2Frandom%2Frandom.factor;h=ebde3802b458066c58ddd7e948fd7a9ec6346b95;hp=26b328b29134546bcc92ab767226f8d36a1f7f55;hb=25a877e50b55c7e6ed75ba8c49de12434237ad23;hpb=e4a9276c430038e37513ffc9c69b83f0ca5b9c58 diff --git a/basis/random/random.factor b/basis/random/random.factor index 26b328b291..ebde3802b4 100755 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -15,12 +15,12 @@ GENERIC: random-32* ( tuple -- r ) GENERIC: random-bytes* ( n tuple -- byte-array ) M: object random-bytes* ( n tuple -- byte-array ) - [ [ ] keep 4 /mod ] dip tuck + [ [ ] keep 4 /mod ] dip [ pick '[ _ random-32* 4 >le _ push-all ] times ] [ over zero? [ 2drop ] [ random-32* 4 >le swap head over push-all ] if - ] 2bi* ; + ] bi-curry bi* ; M: object random-32* ( tuple -- r ) 4 random-bytes* le> ;