factor/extra/random/random-tests.factor

16 lines
466 B
Factor
Raw Normal View History

USING: kernel math random namespaces sequences tools.test ;
IN: temporary
2004-07-16 02:26:21 -04:00
: check-random ( max -- ? )
dup >r random 0 r> between? ;
2004-07-16 02:26:21 -04:00
[ t ] [ 100 [ drop 674 check-random ] all? ] unit-test
2005-10-10 00:08:51 -04:00
: make-100-randoms
[ 100 [ 100 random , ] times ] { } make ;
2005-10-10 00:08:51 -04:00
[ f ] [ make-100-randoms make-100-randoms = ] unit-test
[ 708 ] [ 0 init-random 1000 [ random drop ] each 1000 random ] unit-test
[ 359 ] [ 0 init-random 10000 [ random drop ] each 1000 random ] unit-test