You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
DrawRandomInt produces an ExecutionFailExecption when min and max parameters are equal.
To Reproduce
Call Microsoft.Quantum.Random.DrawRandomInt with the same number for min and max. For example, DrawRandomInt(0, 0).
Expected behavior
Random integer functions typically allow a range of 1, for situations where the range may be variable. For example, I would expect to be able to select a random index of an array like this:
// assume "array" is of length > 0
let randomIndex = DrawRandomInt(0, Length(array) - 1);
Actual behavior
The above code will fail if array is of length 1.
System information
N/A
Additional context
To be clear, the current behavior is intended per the documentation. Really the purpose of this issue is to ask if there is a reason why DrawRandomInt was implemented this way, and if the team would consider changing it.