Testing with random inputs and pattern-based testing