someone asked a vague question which I tried to answer
That's a problem. You shouldn't do that. When a question is unclear work with the question author to clarify the question and then answer it, once it is no longer unclear.
Clearly it helped the OP as he marked it answered, however I am getting down-votes to this answer.
Clearly those other people don't think the answer is useful. Just because the OP thinks it's useful doesn't mean everyone else is obligated to agree.
I made sure that all my lines of code work,
That, alone, doesn't mean that the answer is useful, or a correct answer.
and in my opinion do what the user has asked
You just stated before that the user's question was unclear, so it's your opinion that you don't know if you answered the question asked, because you don't know what the question is asking.
Why would others down vote my correct and accepted answer,
Perhaps they disagree that it's correct. You have yourself said that you don't know if it's correct as you don't know what the question is asking, so it certainly seems reasonable that others would agree. They may also feel that it's not a useful post despite not having factual inaccuracies, as there are any number of factors that can influence the usefulness of an answer beyond just its technical accuracy (it's correctness, being a complete answer to the question, being clear, avoiding poor practices, whether it adds to other existing answers, plagiarising content, etc.).
new Random().Next(...)
thing is of itself worthy of a downvote because of this.word.Length
= 20, and the next random picked is 20, then your answer would cause an IndexOutOfLengthException, asword
has a maximum index of 19. Tada.Next
is exclusive, not inclusive.- 1
was the one that was actually wrong.Random
inline (or next to usage) is one of these things (along with SQL injection). Such answers essentially guarantee that OP will come back next hour/day with another "this does not work. Help!!!" question and multiple people will have to spent time explaining why suggestion was bad. So downvoting also saves SO from one bad question next day.