And what’s the problem with testing test code?
Tell you what. I’ve written probably about a dozen variations of this sort of algorithm for various Project Euler problems; as it turns out I even have some written in rust.
But if you use one of these, then I hope you still also validate its output (or at least, the properties that matter for your test) before using it as input to your test. Why? Simple logic! A test is only meaningful if its premises are valid… and who wants to write a meaningless test?
All that’s really necessary to validate it is to verify that (1) the solutions returned are true solutions (i.e. correct sum, all positive integers), (2) they’re all different, and (3) there’s the right number of them. (I included links to OEIS sequences describing the correct number of solutions for various
Edit: ok guess I misread a bit, and didn’t realize you were trying to sample the solutions rather than generate all of them.