Is the size value used for the generator sample using a special generator?

I generate user data with FsCheck Gen.

Suppose you have a function that returns 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 to generate data:

Gen.sample 0 10 (chooseRectangle 400 200 10)

- argument size(first) used in this case, and does it affect the alteration of values?

+4
source share
1 answer

No, not in your case, as far as I can tell.

- . sample , , , , . , , .

Gen.choose, :

let choose (l, h) = Gen (fun _ r -> range (l,h) r |> fst) 

size - _. . .

+3

Source: https://habr.com/ru/post/1627190/


All Articles