The probem is that you have to see seed the random generator with the srand function
As you can see, the OP already did that in his/her code.
@OP: Here's a great page about using rand(), it will clear things up for you.
Nick Evan
Not a Llama
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
In most of (well known) C and C++ implementations rand is a very bad pseudo-random generator but it NEVER gets two equal numbers in succession (that's why it's a very bad...).
I think it's impossible to get 264412, 26441... if you don't seed the generator with the same value just before every rand call...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
effective, this isn't a chat room. If you don't have anything to add then please don't reply. If everyone posted things like "Nice!" or "I agree!", then it would become difficult to find the useful information in a thread.
If you must share your enjoyment of a post, add to the poster's reputation with whatever pithy and cliche comments you'd like.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401