Thread: random numbers

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    6

    random numbers

    what would be an appropriate cose for recieving random numbers? is there away that the random number can be linked to obtained ine of three answers wih only the input of a single number? my ultimate goal is to build a game called M.A.S.H. The game is a process of only random things occuring:
    M.A.S.H.

    Wife
    1. J.lo
    2. Mariah Carey
    3. Brittany Spears

    Car
    1. benz
    2. beamer
    3. punch buggy

    Number of kids
    1. 5
    2. 6
    3. 0

    The player must pick a number greater than three. lets say 5, then the player will go through and count off each number llife this


    Wife
    1. J.lo (1) (5)
    2. Mariah Carey(2) (1)
    3. Brittany Spears (3) (2)

    Car
    1. benz(4)
    2. beamer(5)
    3. punch buggy(1)

    Number of kids
    1. 5 (2) (3)
    2. 6 (3) (4)
    3. 0 (4) (5)

    every (5) is what you going to have when you get older
    so how can i use this info to make this program

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    I've removed all the pointless replies to this thread. Keep your private conversations to PMs.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    I'm really confused by your question about random numbers. Where in your MASH game do you use random numbers? The only number I see if the one the user enters which wouldn't be random.

  4. #4
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Originally posted by PJYelton
    I'm really confused by your question about random numbers. Where in your MASH game do you use random numbers? The only number I see if the one the user enters which wouldn't be random.
    Funny, I said that same thing, but that post of mine was deleted. I think the mod was just a tad overzealous there. He could've left the post that was related to programming
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by joshdick
    Funny, I said that same thing, but that post of mine was deleted. I think the mod was just a tad overzealous there. He could've left the post that was related to programming
    Originally posted by joshdick
    Anyway, I fail to see what's random about that 'game'. You could preset those options for each category or have the user enter them. Then, you recieve a single digit of input. The counting off you did was very sequential, and thus, could be coded out relatively easily (hint: the modulus operator is more useful than you think).

    I really don't think you need random numbers for what you described. If you want practice using random numbers, code out Yahtzee or better yet, a card game.
    There, better?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Yes, much better

    Thank you, Hammer
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

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. Promlems with Random Numbers
    By Unregistered in forum C++ Programming
    Replies: 13
    Last Post: 03-20-2002, 08:46 PM