factor/core/test/random.factor

13 lines
338 B
Factor
Raw Normal View History

IN: temporary
2005-10-10 00:08:51 -04:00
USING: errors kernel math namespaces sequences test ;
2004-07-16 02:26:21 -04:00
2006-11-02 18:29:11 -05:00
: check-random-int ( max -- ? )
dup >r random-int 0 r> between? ;
2004-07-16 02:26:21 -04:00
2006-11-02 18:29:11 -05:00
[ t ] [ 100 [ drop 674 check-random-int ] all? ] unit-test
2005-10-10 00:08:51 -04:00
: make-100-random-ints
[ 100 [ 100 random-int , ] times ] { } make ;
[ f ] [ make-100-random-ints make-100-random-ints = ] unit-test