microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
katas/content/random_numbers/random_number/Verification.qs
17lines · modecode
| 1 | namespace Kata.Verification { |
| 2 | @EntryPoint() |
| 3 | operation CheckSolution() : Bool { |
| 4 | let testCases = [(1, 3, 1000), (27, 312, 5000), (0, 3, 1000), (0, 1023, 10000)]; |
| 5 | for (min, max, runs) in testCases { |
| 6 | Message($"Testing for min = {min} and max = {max}..."); |
| 7 | let randomnessVerifier = () => CheckUniformDistribution(() => |
| 8 | Kata.RandomNumberInRange(min, max), min, max, runs); |
| 9 | let isCorrect = IsSufficientlyRandom(randomnessVerifier); |
| 10 | if not isCorrect { |
| 11 | return false; |
| 12 | } |
| 13 | } |
| 14 | Message("Correct!"); |
| 15 | true |
| 16 | } |
| 17 | } |
| 18 | |