]> gitweb.factorcode.org Git - factor.git/blob - extra/random/random-tests.factor
Initial import
[factor.git] / extra / random / random-tests.factor
1 USING: kernel math random namespaces sequences tools.test ;
2 IN: temporary
3
4 : check-random ( max -- ? )
5     dup >r random 0 r> between? ;
6
7 [ t ] [ 100 [ drop 674 check-random ] all? ] unit-test
8
9 : make-100-randoms
10     [ 100 [ 100 random , ] times ] { } make ;
11
12 [ f ] [ make-100-randoms make-100-randoms = ] unit-test
13
14 [ 1333075495 ] [ 0 init-random 1000 [ drop (random) drop ] each (random) ] unit-test
15 [ 1575309035 ] [ 0 init-random 10000 [ drop (random) drop ] each (random) ] unit-test