• Advertisement

Archived

This topic is now archived and is closed to further replies.

Something stupid

This topic is 5220 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I have a problem with this int a = z (); int b = z (); int z () { srand (time(0)); return 1 + rand % 10; } With this all I get is the same value for a and b. What do I do if I need different value for a and b ???

Share this post


Link to post
Share on other sites
Advertisement
You only need to call srand once, at the start of the program. It is being called everytime the function runs as it stands now.

Share this post


Link to post
Share on other sites

  • Advertisement