diff --git a/lib/Shuffle.hs b/lib/Shuffle.hs index 6f349c6..14f8919 100644 --- a/lib/Shuffle.hs +++ b/lib/Shuffle.hs @@ -1,12 +1,23 @@ -module Shuffle ( - shuffle +module Shuffle +( shuffle ) where import Data.List import System.Random +---------------------------------------------------------------------- +-- Shuffle a list so that the elements of the list are randomly -- +-- perumated. -- +---------------------------------------------------------------------- + +----------------------------- Constants ------------------------------ + +-- The seed used to generate random numbers. +seed :: Int seed = 20 +---------------------------------------------------------------------- + -- Shuffle a list of values. shuffle :: [a] -> [a] shuffle l = map (l !!) $ generateIndices $ length l @@ -19,6 +30,5 @@ generateIndices size = take size uniqueList uniqueList = nub randomList -- Generate a random generator --- TODO Écht random maken? randomGen :: StdGen randomGen = mkStdGen seed