I'm generating custom data using FsCheck
's Gen
.
Suppose you have a function returning Gen<'T>
:
let chooseRectangle widthMax heightMax offset =
gen {
let! left = Gen.choose(0, widthMax-offset)
let! top = Gen.choose(0, heightMax-offset)
let! width = Gen.choose(offset, widthMax-left)
let! height = Gen.choose(offset, heightMax-top)
return { Left=left
Top=top
Width=width
Height=height
}
}
which is then used for generating data:
Gen.sample 0 10 (chooseRectangle 400 200 10)
is the size
argument (first one) used in this case and does it influence the value repartition?
No, not in your case, as far as I can tell.
That first argument is size.
sample
threads it through into the generator you call it with, but what that generator does with it is up to that particular implementation. For sequence generators it may for instance control the length of the sequence.Your generator however is solely built on top of
Gen.choose
, which explicitly ignores it:where size is the
_
argument. See here.