randomness and portability

This is a discussion on randomness and portability within the C Programming forums, part of the General Programming Boards category; let's say i use the rand() function to achieve randomness. i seed it with a number using srand(). i store ...

  1. #1
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493

    randomness and portability

    let's say i use the rand() function to achieve randomness. i seed it with a number using srand(). i store this number.

    i go to a different machine. i seed with the same number using srand(). does a rand() after that statement equal a rand() from the first machine?

  2. #2
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    If they run the same os/compiler, yes, but otherwise they will probably be different.

Popular pages Recent additions subscribe to a feed

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