Help with making a random number

This is a discussion on Help with making a random number within the C++ Programming forums, part of the General Programming Boards category; cool now how would i limit it under like 100 or so? The % operator Code: int number = rand()%100; ...

  1. #16
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    cool

    now how would i limit it under like 100 or so?
    The % operator

    Code:
    int number = rand()%100; //will make number 0-99

  2. #17
    Registered User
    Join Date
    Mar 2006
    Posts
    18
    ok thanks

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help regarding random number
    By Bargi in forum C Programming
    Replies: 6
    Last Post: 03-11-2009, 01:16 PM
  2. Generating a random number?
    By Konspiracy in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 12:33 AM
  3. Counting number from a random file
    By kamisama in forum C Programming
    Replies: 42
    Last Post: 02-22-2005, 04:16 PM
  4. random number between negative and positive number
    By anomaly in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2003, 07:40 AM
  5. Ask about generate Random number
    By ooosawaddee3 in forum C Programming
    Replies: 2
    Last Post: 07-01-2002, 04:30 AM

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