I try to create a list of integers in f# hedgehog. the list should have between 10 and 20 elements and hold integers in the range between 0 and 5.
Gen.list (Range.linear 10 20) (Gen.int <| Range.constant 0 5) |> Gen.printSample
throws an exception:
=== Outcome ===
[5; 5; 2; 2; 0; 2; 3; 1; 1; 4]
=== Shrinks ===
> System.ArgumentException: The index is outside the legal range.
count = 9, distance past the list = 9
Parameter name: count
at Microsoft.FSharp.Core.DetailedExceptions.invalidArgOutOfRange[?](String arg, Int32 index, String text, Int32 bound) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 57
at Microsoft.FSharp.Collections.ListModule.loop@474-29[a](Int32 count, Int32 i, FSharpList`1 lst) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\list.fs:line 477
at Hedgehog.Gen.atLeast[a](Int32 n, FSharpList`1 xs)
at Microsoft.FSharp.Collections.Internal.IEnumerator.next@193[T](FSharpFunc`2 f, IEnumerator`1 e, FSharpRef`1 started, Unit unitVar0) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 194
at Microsoft.FSharp.Collections.Internal.IEnumerator.filter@188.System-Collections-IEnumerator-MoveNext() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 196
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 77
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 64
at Hedgehog.Gen.PrintSample[a](Gen`1 g)
at <StartupCode$FSI_0044>.$FSI_0044.main@()
So generally the generator creates a correct outcome but then the shrinking logic has issues. Is this a bug? Am I doing wrong? Did I miss documentation that explains this?