in reply to Non-deterministic Testing
Rather than coding them up yourself you might try generating lots of tests with something like Test::LectroTest and then checking whether the results fall in your expected range.
Chris M-x auto-bs-mode