Closed seallard closed 4 years ago
Maybe extract randomness to wrapper functions? Sample the random variable outside the function and provide it as an argument. But some functions requires repeated random sampling... Provide a list of outcomes to function? This is nice, maybe pass function which samples a random variable as an argument? Then the tests can pass some non-random function
Another way would be to test the frequency of the outcomes and see if they match what is expected. But that feels super brittle and clunky. Or maybe not. But it does not seem like the best way in my case
How am I supposed to test code that depends on random variables?