factor/library/test/random.factor

13 lines
327 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
2005-10-08 01:15:14 -04:00
: check-random-int ( max -- )
2005-10-10 00:08:51 -04:00
>r random-int 0 r> between? ;
2004-07-16 02:26:21 -04:00
2005-10-10 00:08:51 -04:00
[ t ] [ 100 [ 674 check-random-int ] all? ] unit-test
: make-100-random-ints
[ 100 [ 100 random-int , ] times ] { } make ;
[ f ] [ make-100-random-ints make-100-random-ints = ] unit-test