Skip to content

Instantly share code, notes, and snippets.

@kputnam
Created February 16, 2012 09:30
Show Gist options
  • Save kputnam/1843618 to your computer and use it in GitHub Desktop.
Save kputnam/1843618 to your computer and use it in GitHub Desktop.
Float distribution in QuickCheck
Prelude Test.QuickCheck> let f n = case span (/= '.') (show n) of (a,b) -> (length a, length b)
Prelude Test.QuickCheck> quickCheck (\x -> collect (f x) $ x /= 0.04882)
+++ OK, passed 100 tests:
28% (3,15)
15% (2,16)
15% (2,15)
8% (4,15)
8% (3,16)
5% (3,14)
5% (1,16)
3% (4,14)
3% (1,17)
2% (4,13)
2% (2,17)
2% (2,14)
1% (6,12)
1% (3,11)
1% (1,2)
1% (1,15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment