Closed christopherkang closed 4 years ago
Hold up - this is more complicated than I expected. Run this method using the resource simulator:
Message($"{Random([1.0, 2.0])}");
I'm getting 0, 2 as my values?!
With the following code:
Message($"{Random([1.0, 2.0, 2.0])}");
I'm getting 0, 1, 3 - I'm guessing that the final element is erroneously increased by 1? Additionally, this bug only happens on the ResourceEstimator - it's fine using the QuantumSimulator.
Hm, this is very odd indeed. Thanks for reporting, we'll go on and investigate.
I think I may have found the issue; it looks like the resources estimator uses a different implementation of Random
than other simulators. That said, investigating it looks like this it is a qsharp-runtime issue so I'll transfer there. Thanks for the report!
This should now be fixed, thanks again for the report @christopherkang!
Describe the bug The 'Random' function is not zero indexed.
To Reproduce Use Message($"{Random[1.0]}");
Expected behavior If our arrays are zero-indexed, the returned index should (intuitively) be zero-indexed.
Screenshots
System information
Additional context