# Why is "Random value excluding both limits" considered an off-topic question?

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?

• Thanks for bringing this to meta, I was considering doing the same thing. Jul 3 '15 at 9:29
• Jul 3 '15 at 9:36

I don't see any reason for the question to be considered off-topic. The task is well-defined, and your concrete implementation works. Applying the same reasoning as for another question with a short code snippet, I've reopened your question.

I voted as such initially and later retracted my vote.

At first sight it looks like example code. Even like a feature request, a stub or a 'how should I do this'. All of those would be off-topic. However, I came to agree with you it could very well be real code with perhaps a skewed explanation.