How would i produce a random value?
?Code:int x = random(0,100);
Printable View
How would i produce a random value?
?Code:int x = random(0,100);
Use rand() (and seed first with srand()). Look them up in your C++ book or try this tutorial:
http://www.robertjacobs.fsnet.co.uk/random.htm
edit : lol nevermind...seems there was a much more easy way posted right before me
I guess it should be like this
Code:int x = randomValue;
randomValue = 0 + rand()%100;
>randomValue = 0 + rand()%100;
I suggest you read both our FAQ and the tutorial posted previously to learn why this is not the best idea.