Ihr seid mir suspekt.
Die Implementierung in Perl habe ich geschrieben, weil cofi schlecht über Perl geredet hat
Und die hier in Haskell um mal wieder was in Haskell gemacht zu haben.
Code: Alles auswählen
getMiddle :: String -> Int -> String
getMiddle string len = take len $ drop offset string
where
offset = ((length string) - len) `div` 2
myRandom :: Integer -> Int -> Integer
myRandom n 0 = n
myRandom n times = myRandom new (times-1)
where
string = show (n*n)
new = read $ getMiddle string intLength
intLength = length $ show n