Thread: Random Numbers

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    16

    Angry Random Numbers

    Hey all,

    Before you go flipping on me, I _HAVE_ read the FAQ and I _HAVE_ got my random numbers to work. I just don't understand what part of the random command.

    Heres the syntax:
    rand( ) % 100

    Now I understand that, that picks a number between 0 - 99, but what is the "%", what does it do and where else can it be used?

    Thanks for the help =)
    "Where genius ends, madness begins."
    -Estauns

  2. #2
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    % is said called modulus
    It is used to get the remander of a number.

    example:
    4%2=0 four divided by two with a remander of zero
    100%3=33333333 one-hundred divided by 3 with a remander of 333333333

    Make sence?

    Can anyone better explane this........
    C++ Is Powerful
    I use C++
    There fore I am Powerful

  3. #3
    Ummm 100 divided by three does not have a remainder of 33333333. The entire answer is 33 remainder 1. Just making a correction for you. =)
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. Doubts regarding random numbers generation
    By girish1026 in forum C Programming
    Replies: 9
    Last Post: 12-31-2008, 10:47 PM
  3. random numbers limit
    By HAssan in forum C Programming
    Replies: 9
    Last Post: 12-06-2005, 07:51 PM
  4. Generate random numbers in Lucky7 project using C#
    By Grayson_Peddie in forum C# Programming
    Replies: 1
    Last Post: 04-11-2003, 11:03 PM
  5. random numbers
    By lil_plukyduck in forum C++ Programming
    Replies: 5
    Last Post: 01-14-2003, 10:14 PM