|
From: <Gen...@ao...> - 2001-02-13 20:56:10
|
In a message dated 2/13/01 12:43:39 PM Pacific Standard Time,
hag...@ho... writes:
> #include <stdlib.h>
>
> int main()
> {
> int number;
> number=1+rand()%13;
> cout << number;
> return 0;
> }
> //end of program
>
> Try this it worked. One stupid thing is that it gives you the same number
> everytime you use it.I have forgotten how to do if you want diffrent
> numbers every time you use the program.
>
>
srand() should do it... You need to 'seed' the random number generator with
some random value.
|