Random number

Lets pretend that i got a random number generator. And i want ot connect it to "int" or "double". If its a success. When i type
cout << the_interger;

cout << the_interger;
Will it become a 2 different numbers or the same nunber?
And how do i make it become the same and different numbers?

Sorry for the bad explanation :/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Random{
private:
   int range;
public:
   Random(int range):range(range){}
   operator int() const{
      return rand()%range;
   }
};

int main(){
   Random Dent(42);
   do std::cout << Dent;
   while(std::cin.get());
}
Last edited on
Topic archived. No new replies allowed.