Ad
  • Default User Avatar

    I need advice on how to test whether the user has actually generated random output (rather than cheating by hard-coding output that merely looks like it could be random).

    I see that you are testing for this with the .expect() method in one of your it blocks. And I understand that you are checking to see whether the frequency of a given value in the output is approximately equal to its probability (weight). So far, so good.

    But here's what I don't get: How does your test framework make the user's attempted solution run multiple times, so that you can determine how frequently each value occurs?

    The kata I am considering would only ask the user to generate one set of random output data, but it looks like my test framework would somehow have to make their solution execute multiple times to determine whether it is likely to be randomly generated. I'm just not sure how to do that.