On Tue, Jun 26, 2018 at 12:01 PM robert therriault <[email protected]> wrote: > I should learn to read the specs, huh Raul?
That's something I often fail to put enough effort into, also. Note also that if there were performance issues here, there are a couple things that could be done to speed things up: [1] Instead of generating six integers, generate 5, and compute the six (by subtracting the sum of the 5 from 172 and seeing if the result is in the range 1..70). Note, however, that this would change the statistical properties of the sixth integer, so it's worth asking if that's a relevant issue. [2] Instead of generating the integer sets one at a time, generate them in batches (you can estimate roughly how many are needed to have a decent chance of generating enough in one batch). This introduces two new issues that would need to be addressed: this approach can generate too many valid sets (but we can toss any extras), and we want to keep from asking for batches that are too large. This uses about twice the code but the code execution time cost per generated set winds up being much lower. That said, both of these are complications, but we don't know if they would be useful. Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
