Hey, thanks everyone for being here. I know I don't stop in as often as I should and I hope you'll forgive me for only dropping in when I have a problem. But with questions like this maybe it's obvious why I don't try to solve other folks problems.
I create a program that generates random puzzles. It does so with a lot of calls to rand(), no funny business. After I finished it I thought "wouldn't it be great if you could re-generate any puzzle you liked simply by inputting the seed that was used before the first call to rand(). So I fiddle things around, store the seed that's used in a new variable, and call srand just before any rand() calls to generate the puzzle. The problem is it's not generating the same puzzle every time!
I'm having it output the code that includes all necessary dimension variables as well as the seed after generation, so I know the seed is the same. Two different puzzles, same code. Sometimes it works. Sometimes it doesn't.
Is there something I don't know about that could effect the output of rand()?
I'm using Code::Blocks with MinGW.
The code is attached below. It's the numbrixgen.h and numbrixgen.c that has the srand and rand calls in question, and the main.c where it's called. The utils is not a part of this discussion but included so you could compile it if you were so inclined.