factor/extra/math/cardinality/cardinality-tests.factor

15 lines
456 B
Factor
Raw Normal View History

2017-01-04 17:16:58 -05:00
USING: kernel layouts literals math math.cardinality
math.functions random sequences tools.test ;
${ fixnum-bits } [ 0 trailing-zeros ] unit-test
{ 0 } [ 0b1 trailing-zeros ] unit-test
{ 1 } [ 0b10 trailing-zeros ] unit-test
{ 2 } [ 0b100 trailing-zeros ] unit-test
{ 3 } [ 0b1000 trailing-zeros ] unit-test
{ t } [
10 [
10,000 [ random-units 10 estimate-cardinality ] [ / ] bi
] replicate [ 1.0 0.15 ~ ] all? ! should be 4%?
2017-01-04 17:16:58 -05:00
] unit-test