21 Oct
2005
21 Oct
'05
3:28 a.m.
In random.h, static rng_type rng; (which says, 'make this variable invisible to other object files') should be extern rng_type rng; (which says, 'declare this, but don't define it') and random.cpp should have rng_type rng; or else each translation unit (source file) will have it's own rng, meaning when you seed rng in test.cpp, random.cpp's rng is not seeded, meaning, of course, that rng() in test.cpp will give random numbers, but rng() in random.cpp will (ironicly) not give random numbers. And don't worry too much about this, linkage issues /are/ confusing.