microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
dmitryv/select-updated

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

katas/content/random_numbers/random_number/solution.md

8lines · modepreview

We can reuse the `RandomBit` operation from the "Generate A Single Random Bit" exercise.

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$.

@[solution]({
    "id": "random_numbers__random_number_solution",
    "codePath": "solution.qs"
})