Commit 9b54327c authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Init Mock.hs

parent d66c24d0
module Mock (mockAlternate, mockRandom) where
import Data.Char
import Data.List
import System.Random
import Data.Time.Clock.POSIX
toUpperBy :: String -> [Bool] -> String
toUpperBy (c:cs) (True:bs) = toUpper c : toUpperBy cs bs
toUpperBy (c:cs) (False:bs) = c : toUpperBy cs bs
toUpperBy (cs) [] = cs
toUpperBy [] _ = []
mockAlternate :: String -> String
mockAlternate str = toUpperBy str $ intersperse True $ repeat False
mockRandom :: String -> IO String
mockRandom str = do
time <- fmap round getPOSIXTime
return $ toUpperBy str $ randoms $ mkStdGen time
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment