Last active
November 13, 2024 09:16
-
-
Save dorchard/daa447ce2538ef3ba614d72310dff4d1 to your computer and use it in GitHub Desktop.
Generating random numbers in (GHC) Haskell without requiring another package
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 GHC.Clock -- imported from the `base` library | |
rand :: IO Double | |
rand = do { x <- getMonotonicTime; return $ x - fromInteger (floor x) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment