-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more prior art #8
Comments
Yup, between "random number in a range", "random int in a range", and "random value from a list", it looks like all the |
I dunno about that. For example, it's non-trivial to get a good distribution of BigInts. You'd have to write something like this today: BigInt(function(){
let s = '';
do { s += Math.floor(Math.random()*10); } while(Math.random() < 0.9);
return s;
}()) There's plenty of ways we could make this better:
And there's plenty of other tricky things. There's lots of design choices to be made with random strings. It's hard to pick a Date (or Temporal.PlainDateTime in modern code) that's bounded by a year/month/day. While the web platform has |
I don't think those are problems this proposal should aim to solve, personally. |
There is no uniform distribution over the integers, but as long as you have a range that you do care about, you can get one easily. For anything else, what distribution you want will depend on your use-case pretty severely. |
Yes, use cases will vary quite a bit, but I think just a few very common (parameterisable) distributions will cover the large majority of non-uniform use cases. As you know, there's precedent for this in Java, Python, and probably others if I went looking. This is getting a bit off-topic from the original post. Maybe I should move it to #6? |
JSVerify is another property-based (generative) testing library for JavaScript. Its documentation lists its Arbitrary instances starting here: https://github.com/jsverify/jsverify#primitive-arbitraries
I think it would be a good (necessary but not sufficient) evaluation criteria to ensure that the Arbitrary instances provided by these generative testing libraries could be relatively easily defined in terms of the functions provided in this proposal.
edit: here's another one: fast-check
The text was updated successfully, but these errors were encountered: