Quote:
Originally Posted by PRoSToTeM@
I think it is defined behaviour: https://github.com/alliedmodders/amx....cpp#L451-L452. So, documentation should be fixed.
What is your suggestion? Producing an error? I think error should be produced only for negative numbers, behaviour for 0 should stay the same.
|
If I were to guess what a function called "random" would return when supplied zero, I would expect zero. From the underlying code, I understand why it does what it does but from a common sense point of view (when used in context) it's seems wrong.
Ideally, I would say that a function called "random" should never manipulate 'result' at all and shouldn't take any arguments. However, obviously, that can't be done. Similarly, changing as I stated above is probably not the best either due to backwards compatibility.
In summary, the best solution here, unfortunately, is updating the documentation.
__________________