There is one question in my mind. What's the logic behind rand function. That is how can we write our own rand function.
One approach may be to use garbage value of variables
But problem with this code is that it will always print same numbers. Is garbage value a fixed value at a memory location. That is say at memory location X if not initialised i will get same value each time. What can be reason behind this?Code:int main() { int a[10]; for(int i=0;i<=10;++i) cout<<a[i]; }