From 3f8ed5bf4cb01a24e14dfd34ef27e64417a95324 Mon Sep 17 00:00:00 2001 From: firephil Date: Wed, 17 Mar 2021 02:04:39 +0200 Subject: [PATCH] added fisher yates random shuffle method without using IO monads --- Haskell-Algorithms.cabal | 3 ++- app/Main.hs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Haskell-Algorithms.cabal b/Haskell-Algorithms.cabal index 02b2069..bf6ccce 100644 --- a/Haskell-Algorithms.cabal +++ b/Haskell-Algorithms.cabal @@ -38,7 +38,8 @@ executable Haskell-Algorithms time >=1.1, random >=0.1, array >= 0.5, - MonadRandom >= 0.5 + MonadRandom >= 0.5, + containers >= 0.1 other-modules: Timer, Mergesort, diff --git a/app/Main.hs b/app/Main.hs index c6dd690..9e8824e 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -4,10 +4,11 @@ import Mergesort(mergeSort) import System.Random import Control.Monad.Random -import ShuffleList(shuffle) +import ShuffleList(shuffle,fisherYates ) -ls = [1..10000] +ls = [1..8000] rev = reverse ls +xs = fisherYates ls main :: IO () main = do