random problem

This is a discussion on random problem within the C++ Programming forums, part of the General Programming Boards category; I have the random library and everything. when i go: Code: randomize(); random(10); it picks a number from 0-9. Can ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    72

    random problem

    I have the random library and everything.

    when i go:

    Code:
    randomize();
    random(10);
    it picks a number from 0-9.

    Can someone help me get the range from 1 to 10?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Code:
    random(10) + 1;
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. Problem with random numbers
    By yaya in forum C++ Programming
    Replies: 6
    Last Post: 05-30-2007, 10:30 AM
  3. Random Numbers...Problem With FAQ Answer
    By sitestem in forum C++ Programming
    Replies: 12
    Last Post: 04-14-2004, 09:22 AM
  4. problem with random integer
    By techno logic in forum C++ Programming
    Replies: 1
    Last Post: 10-07-2002, 02:20 PM
  5. Random things are fine, just one problem with them.
    By DarkSFK in forum C++ Programming
    Replies: 14
    Last Post: 08-19-2002, 08:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21