Commit 83f28313 authored by Mart Lubbers's avatar Mart Lubbers

let ggen generate longer strings

- StrLen is increased to 16384
- ggen will generate strings up to 16384 but the probability decreases
  with the length of the string
parent 5fb78ab6
Pipeline #13134 passed with stage
in 40 seconds
......@@ -47,4 +47,4 @@ derive ggen {}, {!}
maxint :: Int
minint :: Int
StrLen :== 80
StrLen :== 16384
......@@ -186,17 +186,20 @@ where
Nothing -> f s
Just limit -> take limit $ f s
ggen{|String|} s = ["hello world!","Gast": rndStrings 0 aStream]
ggen{|String|} s = ["hello world!","Gast","": rndStrings aStream]
where
rndStrings 0 rnd = ["": rndStrings 1 rnd]
rndStrings len [r,s:rnd]
# (chars,rnd) = seqList (repeatn ((abs r) rem len) genElem) rnd
rndStrings [len:rnd]
# len = toInt ((randIntToReal len) ^ 8.0 * (fromInt StrLen - 0.5))
# (chars,rnd) = seqList (repeatn len genElem) rnd
string = {c \\ c<-chars}
= [string:rndStrings ((len rem StrLen)+1) rnd]
= [string:rndStrings rnd]
where
genElem :: RandomStream -> .(Char, RandomStream)
genElem [r:rnd] = (toChar (32+((abs r) rem 94)), rnd)
randIntToReal :: Int -> Real
randIntToReal x = (toReal x + if (x >= 0) 0.0 4294967296.0) / 4294967295.0
derive ggen (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
derive ggen [], [!], [ !], [!!]
ggen{|{}|} fx r = [{x \\ x <- xs} \\ xs <- ggen{|*->*|} fx r]
......
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