factor/contrib/random-tester/utils.factor

21 lines
489 B
Factor
Raw Normal View History

2006-01-21 01:12:13 -05:00
USING: kernel math sequences namespaces errors hashtables words arrays parser
2006-01-23 18:59:33 -05:00
compiler syntax lists io math-contrib ;
2006-01-21 01:12:13 -05:00
USING: optimizer compiler-frontend compiler-backend inference
inspector prettyprint ;
IN: random-tester
! HASHTABLES
: random-hash-entry ( hash -- key value ) hash>alist nth-rand first2 ;
! ARRAYS
: 4array ( a b c d -- seq ) 2array >r 2array r> append ;
: coin-flip ( -- bool ) 2 random-int 1 = ;
! UNCOMPILABLES
: do-one ( seq -- ) nth-rand call ;