Archived

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

Givo

Random Numbers

Recommended Posts

Hey Gamedev... I''m making a game where sheep will be roaming around. I''ve made it so a Random number generates the sheeps direction and then how many steps it will take in that direction... I''m finding that the sheep always walk around in the same pattern even though they''re random numbers... I''ve try rand() and random() and tried calling the Randomize(); function in C++ builder but they just walk back and forwards in the same pattern... what am I doing wrong?.. thanks for your help...

Share this post


Link to post
Share on other sites
Forgive me if this is wrong or not even close but dont you have to seed the random number in something such as the system clock so your random number isnt the same random number everytime?

err something like that.

Share this post


Link to post
Share on other sites
I think thats what the Randomize() function does... I''m currently trying something else... I''ll see if that works...

Share this post


Link to post
Share on other sites
I know for sure that the rand function in QBasic will give you the same random number everytime if you dont seed it in the system clock and I could have sworn I read something about C++ being the same way.

Share this post


Link to post
Share on other sites
ok, I think I''ve got it working...

I just put the Randomize() in the wrong spot...

thanks for your help guys...

Share this post


Link to post
Share on other sites