Thread: randomness and portability

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

    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
Website Security Test