I am trying to shuffle a list using random package but I cannot solve it for now.
The idea is that the user enter the how many numbers will be in the list and then list will be shuffle.
Example:
*Main> main
Enter number:
10
Expected Output = [5,8,1,3,9,6,4,7,2,10] (order randomized)
This is the code:
import System.IO
import System.Random
main :: IO ()
main = do
putStrLn "Enter number:"
number <- getLine
let n = (read number :: Int)
let list = [1..n]
print list
shuffle :: list -> [randomizedlist]
Aucun commentaire:
Enregistrer un commentaire