Created
February 11, 2019 23:03
-
-
Save Lysxia/d64bbfc4f7acb25a315f5ca605dd2ddc to your computer and use it in GitHub Desktop.
infinite random list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Test.QuickCheck | |
| randomList :: Gen [Double] | |
| randomList = do | |
| start <- choose (0.7 :: Double, 1.2) | |
| go start | |
| where go prev = do | |
| new <- choose (min 0.7 (prev-0.1), max (prev+0.1) 1.2) | |
| acc <- go new | |
| return (new : acc) | |
| foo :: IO () | |
| foo = generate randomList >>= (print . take 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment