Re-assigning random values

This is a discussion on Re-assigning random values within the C++ Programming forums, part of the General Programming Boards category; Hey. I was wondering if , when you assign a random value to x (or whatever) , (using the rand() ...

  1. #1
    Slow Learner Prophet-ex's Avatar
    Join Date
    Jan 2005
    Posts
    9

    Unhappy Re-assigning random values

    Hey. I was wondering if , when you assign a random value to x (or whatever) , (using the rand() function) you could later assign it another random value. Is this possible ?
    Thanks in advance

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    if you mean something like this:
    Code:
    int x = rand();
    // yada yada yada
    // bla bla bla
    x = rand();
    then yes.

  3. #3
    Slow Learner Prophet-ex's Avatar
    Join Date
    Jan 2005
    Posts
    9
    Yeah that's what I meant. Is that how to do it ?

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    yes.

  5. #5
    Slow Learner Prophet-ex's Avatar
    Join Date
    Jan 2005
    Posts
    9
    Okay. Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assigning Multiple Values to Array/ Vector
    By bengreenwood in forum C++ Programming
    Replies: 2
    Last Post: 07-02-2009, 01:15 PM
  2. Replies: 1
    Last Post: 05-31-2009, 04:02 PM
  3. Assigning values from a file
    By ultrabot90 in forum C++ Programming
    Replies: 6
    Last Post: 11-09-2007, 09:28 AM
  4. Assigning values to arrays using fscanf
    By Hallu in forum C Programming
    Replies: 5
    Last Post: 03-24-2004, 04:50 PM
  5. Confusion with assigning values to structs.
    By Tronic in forum C++ Programming
    Replies: 9
    Last Post: 03-22-2004, 07:01 AM

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