I just choose the value 42 there. You could use any number and I *think* you should get the same numbers. So I reckon the time(NULL)'s were returning the same number each time.
The static type ... you should do some reading on it. It basically doesn't really go out of scope when the function ends. It kind of globalises local functions within a set scope, in a sense. So the boolean value (is_set), is there. Then I test it as to whether it's true or not. If it isn't I seed rand with one value and then set its value to true. This means for the rest of the
duration of the program it's value is true which means it doesn't get seeded again with the same value.
Reputation Points: 453
Solved Threads: 57
Posting Virtuoso
Offline 1,873 posts
since May 2007