I was going to start text based game for practice, and while i was just thinking about how i could make it all work, i was wondering is there anyway to call a random funciton? like if i make a random number 1-5 if its 1 rat() is called ect?... i seems every time i poste a question i come up with a good answer half way through, but any help is apreciated



LinkBack URL
About LinkBacks



Using time() as the argument to srand() has subtle issues, rand() isn't a good RNG to begin with, and using % to force the numbers into a smaller range makes it even worse. That's your fair warning, but for simple stuff it really doesn't matter because it'll look random enough.