I recently asked this question: Random value excluding both limits
The code to review is as follows:
do {
var random = Math.random();
} while(random === 0);
I know it is short and looks like stub code, but it actually is my real live code to generate the random number. I did not simplify it, I did not modify it. I copy-pasted it from my original code.
Now the question is put on hold as off topic with this reason given:
"Questions must involve real code that you own or maintain. Pseudocode, hypothetical code, or stub code should be replaced by a concrete example. Questions seeking an explanation of someone else's code are also off-topic."
In my opinion, this reason is not valid. The code, although very short, is real and I want to know if there are any unintended effects from using a loop to generate the random value.
My question also clearly states my question:
Is there any downside to using this snippet
Reading the comments to the question, it seems the decision whether the question is off topic or not is a little opinion based.
Why exactly is this question considered off topic? How would it have to be modified to be on topic?