fscheck / FsCheck

Random Testing for .NET
https://fscheck.github.io/FsCheck/
BSD 3-Clause "New" or "Revised" License
1.17k stars 156 forks source link

Expose `Gen.choose64` #649

Closed corsinpfister closed 7 months ago

corsinpfister commented 11 months ago

I'd find it very useful to have a version of Gen.choose that works with int64 instead of int. I've had a quick look at the source code, and it looks like there already is a Gen.choose64 function. It's just not exposed due to the internal access modifier.

What's the reason for keeping it internal? Couldn't it be exposed?

One use case for me would be that it would allow me to work more easily with the ticks of a DateTimeOffset; something along the lines of

let dateTimeOffsetGenerator(min: DateTimeOffset, max: DateTimeOffset) =
    gen {
        let maxTicksToAdd = (max - min).Ticks
        let! ticksToAdd = Gen.choose64(0, maxTicksToAdd)
        return min.AddTicks(ticksToAdd)
    }
kurtschelfthout commented 11 months ago

Sure, no objection.