typelift / SwiftCheck

QuickCheck for Swift
MIT License
1.42k stars 106 forks source link

StdGen.genRange seems to have wrong value #292

Open grigorye opened 5 years ago

grigorye commented 5 years ago

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.

CodaFi commented 5 years ago

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

CodaFi commented 5 years ago

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