microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
katas/content/random_numbers/random_number/solution.md
8lines · modecode
| 1 | We can reuse the `RandomBit` and `RandomNBits` operations from earlier exercises. |
| 2 | |
| 3 | We'll generate an $N$-bit random number by calling the `RandomNBits` operation, where $N$ is the bitsize of $max - min$. We can repeat this process until the result is less than or equal than $max - min$, and return that number plus $min$. |
| 4 | |
| 5 | @[solution]({ |
| 6 | "id": "random_numbers__random_number_solution", |
| 7 | "codePath": "Solution.qs" |
| 8 | }) |
| 9 | |