jeudi 11 avril 2019

Random numbers in Agda

I need to generate a simple random number in Agda.

I tried googling phrases like 'random number agda' but couldn't find any working code.

In Haskell the code would be

    import System.Random

main :: IO ()
main = do
    -- num :: Float
    num <- randomIO :: IO Float
    -- This "extracts" the float from IO Float and binds it to the name num
    print $ num

outputs would be

0.7665119

or

0.43071353

What Agda code would achieve the same results (if it's possible)?

Working code would be appreciated!




Aucun commentaire:

Enregistrer un commentaire