tut 19 particle engine
I noticed that the random numbers in this tut are never seeded. Yet, when I seeded them, I noticed little difference in the results. Does this mean I put the seed in the wrong spot (beginning of winmain) or are there so many particles that it makes little noticeable difference? From my experience in random numbers in the dos console, not seeding them generally resulted in "random numbers" that always showed the same numbers each time it ran through.
Random numbers are not truely random but rather pseudo-random and will produce the same sequence given the same seed, so the question I would ask is how are you seeding them?
--
Cheers,
Darren Clark
Cheers,
Darren Clark
eSCHEn is correct
You should seed with time, I do
time.h
srand( (unsigned)time( NULL ) ); //New random seed
You should seed with time, I do
time.h
srand( (unsigned)time( NULL ) ); //New random seed
#include <ctime> /*** skipping code ***/int WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop srand(time(NULL));
The above shows that I included ctime, and where I placed srand, and that I used srand(time(NULL)). The only difference is that I'm excluding the unsigned variable.
I guess your question is partially my fault, since I excluded any snippets.
It is possible, though, that maybe it is random, and that I'm just not observant enough to compare when it's seeded and not seeded.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement