diff --git a/basis/random/random-tests.factor b/basis/random/random-tests.factor index e686dd7301..63c2159ab6 100644 --- a/basis/random/random-tests.factor +++ b/basis/random/random-tests.factor @@ -1,5 +1,5 @@ USING: random sequences tools.test kernel math math.functions -sets ; +sets grouping ; IN: random.tests [ 4 ] [ 4 random-bytes length ] unit-test @@ -17,3 +17,6 @@ IN: random.tests [ t ] [ 1000 [ 400 random ] replicate prune length 256 > ] unit-test [ f ] [ 0 random ] unit-test + +[ f ] +[ 100 [ { 0 1 } random ] replicate all-equal? ] unit-test diff --git a/basis/random/random.factor b/basis/random/random.factor index 554ed5c96a..cb4a141a98 100755 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -53,7 +53,7 @@ PRIVATE> ] if-empty ; : randomize ( seq -- seq' ) - dup length 1 (a,b] [ dup random pick exchange ] each ; + dup length 1+ 2 (a,b] [ [ random ] [ 1- ] bi pick exchange ] each ; : delete-random ( seq -- elt ) [ length random-integer ] keep [ nth ] 2keep delete-nth ;