module Data.Tensort.Subalgorithms.Bogosort (bogosort, bogosortSeeded) where import Data.Tensort.Utils.Check (isSorted) import Data.Tensort.Utils.RandomizeList (randomizeList) import Data.Tensort.Utils.Types (Sortable (..)) bogosort :: Sortable -> Sortable bogosort :: Sortable -> Sortable bogosort Sortable xs = Sortable -> Int -> Sortable bogosortSeeded Sortable xs Int 143 bogosortSeeded :: Sortable -> Int -> Sortable bogosortSeeded :: Sortable -> Int -> Sortable bogosortSeeded Sortable xs Int seed | Sortable -> Bool isSorted Sortable xs = Sortable xs | Bool otherwise = Sortable -> Int -> Sortable bogosortSeeded (Sortable -> Int -> Sortable randomizeList Sortable xs Int seed) (Int seed Int -> Int -> Int forall a. Num a => a -> a -> a + Int 1)