This post is part of a series of posts on implementing a minimal version of QuickCheck from scratch. The source code is available on GitHub.
Two generators are required for this, which have been ported already on previous posts:
- a generator for integers (with absolute value bounded by the generation size)
- a generator that applies a function (in this case
Operators.int64<^T>) to an existing generator
The long integers are going to be generated by the integer returned by the first generator and then multiplied by a 16-bit1 integer’s largest possible value.
Given the above, a long integer generator can be written as:
Finally, here are some sample long integers:
To be more precise, I should use a 32-bit integer’s largest possible value, but then the generated numbers become very big and less interesting. ↩