Commits

Anonymous committed 33f328f

Easyplot

Comments (0)

Files changed (2)

md5distribution.exe

Binary file modified.

md5distribution.hs

 import Data.List
 import Control.Arrow
 import Numeric
+import Graphics.EasyPlot
 
 randomStr :: Int -> String
 randomStr len = take len $ randomRs ('a','z') $ unsafePerformIO newStdGen
 frequency = map (\xs -> (head xs, length xs)) . group . sort 
 
 runWithStringsNumberAndLen numStrings stringsLen = 
-	frequency (map (\x -> jokeRank x) (take numStrings (testStrings stringsLen)))
+	frequency (map (\x -> (fst (head (readFloat (jokeRank x))))) (take numStrings (testStrings stringsLen)))
 
 formatStatTuple (x, y) = x ++ "," ++ (show y)
 
 main = do
-	 putStrLn (unlines (map (\x -> formatStatTuple x) (runWithStringsNumberAndLen 10000 10))) 
+	let d = (runWithStringsNumberAndLen 10000 10);
+	plot (PNG "distr.png") $ Data2D [Title "Distribution"] [] d
+	-- putStrLn (unlines (map (\x -> formatStatTuple x) d))