Generate built-in `Range`
See original GitHub issueHi! 👋
Was thinking of adding a built-in generator of the System.Range
struct, as this would expand the default generator functionality.
Am currently using this:
let range = gen {
let! min = Gen.choose (0, Int32.MaxValue)
let! max = Gen.choose (min, Int32.MaxValue)
return Range (min, max) }
To make sure that the minimum is always lower than the maximum. But, with some additional options, one could include Range.StartAt
and Range.EndAt
too.
Just a suggestion when using the awesome FsCheck library 😉 .
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
What is a Python Generator? (Implementing Your Own ...
Generators in Python (also called generator functions) are used to create a series of values one at a time. Let's learn how they...
Read more >Python range()
The range() function returns a sequence of numbers between the give range. Example. # create a sequence of numbers from 0 to 3...
Read more >Built-in Functions — Python 3.11.4 documentation
The bytearray class is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual...
Read more >How to generate range of numbers from 0 to n in ES2015 ...
Stick to range as util function or define your own object (with a type if using TS) and call it ArrayV2 or something....
Read more >The Python range() Function (Guide)
In simple terms, range() allows you to generate a series of numbers within a given range. Depending on how many arguments you pass...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah I think that makes sense. Or even extract the code and parametrize the contructor, could be slightly faster without creating an intermediate type.
For standard types like
System.Range
I think it certainly makes sense to have them built-in.Great! Happy to pick this up, but the supported frameworks on the main project are still not in the range where the
System.Range
is supported (net452;netstandard2.0;netstandard1.6;netstandard1.0
) so maybe this could be set up on-hold till we update FsCheck towards .NET 6.