fix { } randomize, more unit tests
parent
1418a67cc6
commit
a0491606bc
|
@ -18,6 +18,12 @@ IN: random.tests
|
|||
|
||||
[ f ] [ 0 random ] unit-test
|
||||
|
||||
[ 0 ] [ { } >randomize-range length ] unit-test
|
||||
[ 0 ] [ { 1 } >randomize-range length ] unit-test
|
||||
|
||||
[ { } ] [ { } randomize ] unit-test
|
||||
[ { 1 } ] [ { 1 } randomize ] unit-test
|
||||
|
||||
[ f ]
|
||||
[ 100 [ { 0 1 } random ] replicate all-equal? ] unit-test
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ M: f random-32* ( obj -- * ) no-random-number-generator ;
|
|||
[ random-bytes >byte-array byte-array>bignum ]
|
||||
[ 3 shift 2^ ] bi / * >integer ;
|
||||
|
||||
: >randomize-range ( seq -- range )
|
||||
length 1+ 2 (a,b] ; inline
|
||||
: >randomize-range ( seq -- range/iota )
|
||||
length dup 2 < [ drop 0 iota ] [ 1+ 2 (a,b] ] if ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
|
|
Loading…
Reference in New Issue