i'm trying to generate a random index (Int), with this code: randomRIO (0, 2 :: Int). But its generate a IO Int, so i cant do something like this: [1,2,3] !! randomIndex. What does it have to be done to convert the IO Int to Int? Thanks.
randomRIO (0, 2 :: Int)
[1,2,3] !! randomIndex
Aucun commentaire:
Enregistrer un commentaire