Random Numbers

This is a discussion on Random Numbers within the C++ Programming forums, part of the General Programming Boards category; ok, I got the whole random numbers to do 0-3 and stuff, but is there a way to get it ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    30

    Random Numbers

    ok, I got the whole random numbers to do 0-3 and stuff, but is there a way to get it like 2-4? or something like that instead of having 0 i know there is but dont know how... plz help
    HOw are ya?

  2. #2
    Registered User
    Join Date
    Aug 2001
    Location
    computers/ theatre, travelingstudentL>- Northern California NativeNorthern California3D&Tie-DyeStudent1>. Admirer of C Bangalore Net surfingTeacher >/ >0 nagpurteaching >1  >2
    Posts
    61
    Add 2:

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    162
    Random numbers 0-3 would be found by rand() % 4, so adding two would get 2-5. This will get 2-4: random = ((rand() % 3) + 2) if you couldn't figure it out.
    Last edited by Crossbow; 03-31-2002 at 09:03 PM.

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, 09:47 PM
  3. random numbers limit
    By HAssan in forum C Programming
    Replies: 9
    Last Post: 12-06-2005, 06: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, 09:14 PM

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