eksamor said:
I can't seem to control the rand() function. I just makes an evil
humongeous number. How do I make it generate random numbers from 1 -
4000??
Beginners often seem to believe that they have discovered new problems,
but that is rarely so. In fact, most problems they run into have been
encountered many rimes in the past. This is the reason that many
newsgroups have "Frequently Asked Question" lists (FAQs). It is
normally expected that a poster will have checked the FAQ _before_
posting. Sometimes people will complain that they had no idea that
there was a FAQ or where it might be. But it is also expected behavior
to follow a newsgroup before posting. In almost every newsgroup with a
FAQ, the FAQ itself or at least a document pointing to it will be posted
about twice a month. Another objection often seen is that new posters
don't know about these simple guidelines of looking for the FAQ or
following the newsgroup. This is similar to claiming that there is no
need to check which side of the road people drive on when one goes to
another country. Unfortunately, for reasons known only to themselves,
people who provide newsreaders no longer provide them with subscriptions
already built in to < You need to do that
yourself.
In the case of <the FAQ can be found at
<
http://c-faq.com/>. In your case, the particular question you need to
check is
<
http://c-faq.com/lib/randrange.html>
"Question 13.16: Q: How can I get random integers in a certain range?".