SwiftCheck icon indicating copy to clipboard operation
SwiftCheck copied to clipboard

StdGen.genRange seems to have wrong value

Open grigorye opened this issue 6 years ago • 2 comments

https://github.com/typelift/SwiftCheck/blob/9e53d13c02b48080894b8d6763010781c8cfdc3b/Sources/SwiftCheck/Random.swift#L84-L86

I wonder if it should be (1, 2147483562) or something like that (sorry, I have hard time figuring the exact numbers out). I mean, even though the type of the value produced by next is Int, the actual value is defined by the algorithm that operates in subdomain of 32-bit numbers.

grigorye avatar Aug 05 '19 20:08 grigorye

Honestly, genRange is an artifact of the old non-deterministic RNG. It should be deprecated and removed in the next point release.

CodaFi avatar Aug 05 '19 22:08 CodaFi

Started https://github.com/typelift/SwiftCheck/commit/2d3b562becf843b6fcefe2d0642a6fbd7014fd32

CodaFi avatar Aug 12 '19 21:08 CodaFi